apiflask
apiflask copied to clipboard
Wrong URL schema on swagger page
trafficstars
Description of the issue
The service is deployed with gunicorn + Nginx. The actual URL schema is https, but the server URL schema on Swagger page is http. When we click the Try it out button, the request will be blocked by the browser.
We can use the / as the default server URL to fix the issue.
https://swagger.io/docs/specification/v3_0/api-host-and-base-path/
Environment:
- Python version: 3.12.8
- Flask version: 3.0.3
- APIFlask version: 2.2.1
Configure it with the below example code.
app.servers = [
{
'url': 'https://api.example.com'
}
]
See more details in Configuration.
Is the Nginx proxy configuration incorrect? Could you share the proxy-related config section?
Possible useful info:
- https://docs.nginx.com/nginx/admin-guide/security-controls/securing-http-traffic-upstream/#complete-example
- https://serverfault.com/questions/372886/prevent-nginx-from-redirecting-traffic-from-https-to-http-when-used-as-a-reverse