swagger-editor
swagger-editor copied to clipboard
Missing best practice for using behind proxy and sub-path
Environment
- OS: [linux, window, macOS]
- Browser: [chrome, firefox]
- Version: [latest]
- Method of installation: [docker]
- Swagger-Editor version: [latest]
Content & configuration
I can successfully use swagger-editor with an individual swagger.yaml and with the workaround from https://github.com/swagger-api/swagger-editor/issues/2337#issuecomment-768586193 I can use it with another baseurl.
docker run --rm --name swaggertest -p 8079:8080 -v $(pwd)/test/swagger.yaml:/etc/nginx/html/swagger.yaml -e SWAGGER_FILE=/etcginx/html/swagger.yaml -e BASE_URL=/toolchain/swagger swaggerapi/swagger-editor
Looks great on my browser under: ip:8079/toolchain/swagger
But using nginx as a proxy for managing all tools in sub-paths with this "oversized" config brings back the petshop on the left side and errors on the right:
Failed to load API definition. NetworkError when attempting to fetch resource. /swagger.yaml
# swagger
location /toolchain/swagger/ {
expires -1;
sendfile off;
proxy_pass http://ip:8079/toolchain/swagger/;
proxy_redirect default;
proxy_http_version 1.1;
# Required for websocket agents
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
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;
proxy_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffering off;
proxy_request_buffering off;
proxy_set_header Connection "";
}
Is there a best practice for using the container behind nginx/apache-proxies?