Swagger UI is changing the protocol in the request from https to http
Asked Answered
L

3

9

In the swaggerUI it's default takes the 'http' but the actual API will support the 'https' One possible way, will remove the 'http' in the schema, but in local unable to test the 'https' so what is the possible solution for this issue?

Anyone have idea pls help me to find it out...

Ladykiller answered 7/3, 2017 at 11:3 Comment(0)
A
2

As its evident from this open issue of swagger-api/swagger-ui in github, for you to use https in localhost, make a self signed certificate using openssl and make the browser trust your self signed certificate.

How to get self signed certificate for Apache is explained here.

Almira answered 24/3, 2017 at 21:17 Comment(5)
yes,Tito you are right ...Thanks..Is this a only way?Ladykiller
@Ladykiller if you want to have https in localhost, self signing is the only way. You cannot get a CA signed certificate for localhost by design.Almira
Okay ..Thank you so muchLadykiller
@Ladykiller I also found this tool recently to easily make localhost domain names. github.com/typicode/hotelAlmira
Another link for https localhost certificate medium.freecodecamp.org/…Almira
A
8

Just put it in your docs

schemes:
- "https"
- "http"

And you'll got select with provided schemes

enter image description here

Assisi answered 5/8, 2020 at 9:34 Comment(0)
A
2

As its evident from this open issue of swagger-api/swagger-ui in github, for you to use https in localhost, make a self signed certificate using openssl and make the browser trust your self signed certificate.

How to get self signed certificate for Apache is explained here.

Almira answered 24/3, 2017 at 21:17 Comment(5)
yes,Tito you are right ...Thanks..Is this a only way?Ladykiller
@Ladykiller if you want to have https in localhost, self signing is the only way. You cannot get a CA signed certificate for localhost by design.Almira
Okay ..Thank you so muchLadykiller
@Ladykiller I also found this tool recently to easily make localhost domain names. github.com/typicode/hotelAlmira
Another link for https localhost certificate medium.freecodecamp.org/…Almira
T
2

Add this to your settings.py if you are using Django

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
Tome answered 5/6, 2023 at 5:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.