How can I configure Sanic to run on URL path (f.e. /api/) including docs (reference to openapi.json to be relative or /api/docs/openapi.json and not /docs/openapi.json)?
Tried app.config.SERVER_NAME but it didn’t work for me.
Use case: web application (running different application server) runs at www.domain.com and I need Sanic to run at www.domain.com/api (both behind nginx reverse proxy).
app.config.SERVER_NAME sets your server name, not the relative path
I would use a blueprint and set the url_prefix to “/api”
Alternately, since you’re using nginx you could use the proxy config to rewrite the request.
Well, that is not entirely true. SERVER_NAME
is an over-burdened property and one we are actively trying to rework. Regardless, I think what you want is this: Application Mounting | Sanic Framework