[X] I have searched existing issues to ensure the regression has not already been reported
Last working version
3.1.0
Stopped working in version
4.0.0
Node.js version
18.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Debian 11
💥 Regression Report
When a reverse proxy rewrites the URL path before forwarding the request to the Node.js server running swagger-ui the interface gets confused and the Swagger UI becomes inoperable.
For example when a GET /api/documentation request is remapped to GET /documentation before being passed on to swagger-ui v4.0.0 the resulting html page it responds to contains resources links to /documentation/static/<resource>, which will not load as the server hosts these resources under /api/documentation/static/<resource>. Trying to access /api/documentation/static/index.html which used to work causes swagger-ui to redirect the browser to /documentation.
In swagger-ui v3.1.0 all links were relative. A GET /api/documentation request remapped to GET /documentation would correctly reply with a relative redirect to ./documentation/static/index.html sending the browser to /api/documentation/static/index.html. This page only used relative links of the form ./<resource> so it wasn't sensitive to the path prefix being remapped.
Steps to Reproduce
Configure a reverse proxy in front of swagger-ui, for example with an Apache ProxyPass directive.
Observe that in v3.1.0 you can access the swagger UI under /api/documentation, while in v4.0.0 it doesn't work at all.
Expected Behavior
Upgrading from 3.1.0 shouldn't cause the swagger UI to break when hosted behind a reverse proxy where the path has been rewritten. Or alternatively, this breakage/new requirement should be clearly documented.
Prerequisites
Last working version
3.1.0
Stopped working in version
4.0.0
Node.js version
18.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Debian 11
💥 Regression Report
When a reverse proxy rewrites the URL path before forwarding the request to the Node.js server running swagger-ui the interface gets confused and the Swagger UI becomes inoperable.
For example when a
GET /api/documentation
request is remapped toGET /documentation
before being passed on to swagger-ui v4.0.0 the resulting html page it responds to contains resources links to/documentation/static/<resource>
, which will not load as the server hosts these resources under/api/documentation/static/<resource>
. Trying to access/api/documentation/static/index.html
which used to work causes swagger-ui to redirect the browser to/documentation
.In swagger-ui v3.1.0 all links were relative. A
GET /api/documentation
request remapped toGET /documentation
would correctly reply with a relative redirect to./documentation/static/index.html
sending the browser to/api/documentation/static/index.html
. This page only used relative links of the form./<resource>
so it wasn't sensitive to the path prefix being remapped.Steps to Reproduce
Configure a reverse proxy in front of swagger-ui, for example with an Apache ProxyPass directive.
Observe that in v3.1.0 you can access the swagger UI under /api/documentation, while in v4.0.0 it doesn't work at all.
Expected Behavior
Upgrading from 3.1.0 shouldn't cause the swagger UI to break when hosted behind a reverse proxy where the path has been rewritten. Or alternatively, this breakage/new requirement should be clearly documented.