I'm trying to get the Swagger UI from Flask-RESTplus working on a server using Nginx as a proxy.
Swagger served on /api and works locally using http://localhost:5000/api . I'm trying to setup the Nginx as a proxy so I can go to http://ServerIP/api and see the Swagger UI.
I've tried many configurations for Nginx and currently have
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:5000;
proxy_redirect off;
proxy_intercept_errors on;
proxy_http_version 1.1;
}
However, I just see a blank page when going to http://ServerIP/api. In the Chrome dev tools there is an error:
Uncaught ReferenceError: SwaggerUIBundle is not defined
at window.onload (api:75)
which refers to:
<script src="/swaggerui/swagger-ui-bundle.js"></script>
<script src="/swaggerui/swagger-ui-standalone-preset.js"></script>
<script type="text/javascript">
window.onload = function() {
const ui = window.ui = new SwaggerUIBundle({
But I am able to get to (200 OK, serves up the javascript files) http://ServerIP/swaggerui/swagger-ui-bundle.js http://ServerIP/swaggerui/swagger-ui-standalone-preset.js.
Any ideas what could be the issue?