-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Suppose I have my application reverse proxied, such that http://my.domain/foo (e.g. Traefik or Nginx) has the upstream http://localhost:8000 (the Starlette app). url_for will generate urls relative to the upstream url. How do I make it produce urls relative to the external url (with prefix /foo)?
For other projects, e.g. Flask/Werkzeug, this can be handled by setting SCRIPT_NAME in the request environment (scope) if the 'X-Forwarded-Prefix' header is set. It does not look like there is an equivalent option in Starlette.
Am I missing something? Otherwise, consider this a feature request.