Ramyachinna
Ramyachinna

Reputation: 483

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

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...

Upvotes: 9

Views: 27686

Answers (3)

Paras
Paras

Reputation: 711

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

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

Upvotes: 2

Ruslan Valeev
Ruslan Valeev

Reputation: 1907

Just put it in your docs

schemes:
- "https"
- "http"

And you'll got select with provided schemes

enter image description here

Upvotes: 8

Tito
Tito

Reputation: 9044

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.

Upvotes: 2

Related Questions