Is there a variable/header I need to set to bind a Sanic application to a sub-path? During development my app runs at root, but when I deploy all of my endpoints are prefixed with, e.g. /api/v1
, as I’m stitching together multiple apps with docker-compose. In flask, for reference, I would do this:
location /api/v1/ {
proxy_set_header SCRIPT_NAME /api/v1/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://api:8080;
}
and Flask would get the url right. with the same setup and Sanic I get a 404.
thoughts?