Serve Swagger spec per request so it works behind a proxy prefix.
The baked-in host and basePath pointed "Try it out" at the app's own listen address, so requests from the browser never reached the server. doc.json is now built from the incoming request, using X-Forwarded-Prefix to restore the path prefix nginx strips before proxying. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -68,6 +68,9 @@ server {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# The prefix is stripped above, so tell the app what it was: Swagger
|
||||
# needs it to build URLs the browser can actually reach.
|
||||
proxy_set_header X-Forwarded-Prefix /online-backend;
|
||||
}
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
|
||||
Reference in New Issue
Block a user