API explorer assumes HTTP, breaks curl. #1186

Closed
opened 2025-11-02 03:51:46 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @issmirnov on GitHub (Oct 27, 2017).

  • Gitea version (or commit ref): 1.2.2
  • Git version: 2.7.4
  • Operating system: Ubuntu 16.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:

Description

When I use the API explorer (lives on /swagger) I am unable to execute commands. Looking at the generated curl command, I see that it starts with http and not https. Since the curl command doesn't have the follow redirects flag (-L) the command fails.

Error: TypeError: Failed to fetch

Screenshots

image 2017-10-26 at 22 26 11

Originally created by @issmirnov on GitHub (Oct 27, 2017). - Gitea version (or commit ref): 1.2.2 - Git version: 2.7.4 - Operating system: Ubuntu 16.04 - Database (use `[x]`): - [ ] PostgreSQL - [X] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [X] No - https://try.gitea.io/swagger send me to a user page, not API explorer. - [ ] Not relevant ## Description When I use the API explorer (lives on `/swagger`) I am unable to execute commands. Looking at the generated curl command, I see that it starts with `http` and not `https`. Since the curl command doesn't have the follow redirects flag (`-L`) the command fails. Error: `TypeError: Failed to fetch` ## Screenshots ![image 2017-10-26 at 22 26 11](https://user-images.githubusercontent.com/5771615/32089074-b9ee48d8-ba9c-11e7-8106-11dd07fe327d.png)
GiteaMirror added the type/docs label 2025-11-02 03:51:46 -06:00
Author
Owner

@issmirnov commented on GitHub (Oct 27, 2017):

FWIW, Application URL = https://git.smirnov.work, so the HTTPS is there.

@issmirnov commented on GitHub (Oct 27, 2017): FWIW, `Application URL = https://git.smirnov.work`, so the HTTPS is there.
Author
Owner

@jonasfranz commented on GitHub (Oct 30, 2017):

This is a problem of swagger UI. Please simply select HTTPS as schema if you only use HTTPS. (See screenshot). This can't be removed since some users allow HTTP traffic without redirection. And swagger ui could (not yet) determine if HTTPS is redirected or not.
HTTPS Schema

@jonasfranz commented on GitHub (Oct 30, 2017): This is a problem of swagger UI. Please simply select HTTPS as schema if you only use HTTPS. (See screenshot). This can't be removed since some users allow HTTP traffic without redirection. And swagger ui could (not yet) determine if HTTPS is redirected or not. ![HTTPS Schema](https://user-images.githubusercontent.com/5757182/32176517-3199d152-bd88-11e7-9d6a-3ec4be4dd9c3.png)
Author
Owner

@issmirnov commented on GitHub (Nov 3, 2017):

Understood, thanks!

@issmirnov commented on GitHub (Nov 3, 2017): Understood, thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1186