Swagger-ui: Change protocol from http to https without adding schemes to Swagger UI 2.0

Created on 10 Jul 2018  路  8Comments  路  Source: swagger-api/swagger-ui

Is there any way we can make swagger "Try me" requests change protocol to https without schemes parameter in swagger JSON. Because if I add schemes to https, I am unable to test locally the endpoints in Swagger UI. And if the Swagger UI is hosted over https, will the requests too automatically be made over https? Because right now our live portal is deployed over http.

lock-bot question

Most helpful comment

AFAIK, it will if your document does not have a schemes value. According to this line, it will use the same scheme as your document url.

All 8 comments

@pruthvigh, do you have http in your document currently, or does your document not have a schemes value at all?

@shockey I don't have schemes in my document and I get a "Service requires SSL" error on the console.

@pruthvigh It's worth mentioning that: if your swagger UI is hosted over https, it cannot load any docs hosted over http. Your browser will block the request because it's insecure (images are exceptions). You cannot invoke any api hosted over http either.

@bestmike007 Swagger UI is on an S3 static website hosted over HTTP now but, we will be getting a custom domain name and SSL certificate. Other than that everything is over https so once the S3 website too is hosted over HTTPS will the API be automatically invoked over https?

AFAIK, it will if your document does not have a schemes value. According to this line, it will use the same scheme as your document url.

@bestmike007 Everything you said is the case with me. I will wait until our portal is deployed over https. Thanks.

@bestmike007 I was able to add SSL from AWS Certificate Manager and serve the website via CloudFront. All the requests are now made over https. Thanks again.

Closing due to inactivity.

This is simply to keep our issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

julienkosinski picture julienkosinski  路  34Comments

newtechfellas picture newtechfellas  路  47Comments

grosch picture grosch  路  75Comments

lmprice picture lmprice  路  104Comments

SzymonKlimuk picture SzymonKlimuk  路  32Comments