I am running Django with Nginx in 8000 port. Here Nginx is exposed outside in 8000 port. But in Swagger UI the base_url is set as without port. So Swagger is trying to access endpoints without a port, then it gives a response as TypeError: Failed to fetch.
Kindly refer to the below image to know how base_url is set
Kindly refer to the below image to know how a request is sent from Swagger
When I access the endpoint (with port) using Postman it is working fine. The problem occurs only when I try using Swagger (because is sent a request without port).
Here I want Swagger to sent all the requests with the port. Please help me to resolve this issue. Thanks.
Note:
- I'm using the drf-yasg==1.17.1 package to generate Swagger UI
- Other requirements are Django==3.0.3 and djangorestframework==3.11.0