-
I'm trying to set
How can I do it? Refs: |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
I struggled with this as well. Got it working in the end, albeit by setting Before upgrading it didn't work either using the current Extending from @tiangolo will the images be updated in the near future? |
Beta Was this translation helpful? Give feedback.
-
@poppash Python 3.7.8 Run configuration: I think the error is in the path here is console log: |
Beta Was this translation helpful? Give feedback.
-
Gunicorn 20.1.0 You can fix it with: In this case you can change the ROOT_PATH with environment variable. After that you can strip the ROOT_PATH within the proxy. Example: Remove the /auth/v1 from the endpoints. On the proxy you can strip it with:
After that it must work properly. I also struggled for hours by the way. Tried the class ConfigurableWorker(UvicornWorker) method and struggled hours with the Gunicorn config but nothing worked. The solution above worked perfectly. |
Beta Was this translation helpful? Give feedback.
-
For anybody coming here from the new ngrix-proxy version where the |
Beta Was this translation helpful? Give feedback.
-
@0anton I came across this ticket while researching how to do this in here's an excerpt from our
I am in the process of documenting this property if it's of interest to anybody. |
Beta Was this translation helpful? Give feedback.
-
@devraj Thank you so much! For people using server {
listen 80;
server_name example.com;
location / {
# For my react frontend served by an nginx container
proxy_pass http://localhost:7000;
}
location /api/{
# For FastAPI app running in docker container, where the endpoint should be /api/
# notice the trailing slash at the end, it is important,so that it performs stripping properly.
proxy_pass http://localhost:8100/;
}
} @tiangolo, if it is required, I could add a section for nginx here in the documentation. |
Beta Was this translation helpful? Give feedback.
-
Now that Uvicorn supports managing workers with Because of that, I deprecated this Docker image: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#-warning-you-probably-dont-need-this-docker-image I think having a custom Now building an image from scratch with Uvicorn should make it much simpler. 🤓 |
Beta Was this translation helpful? Give feedback.
Now that Uvicorn supports managing workers with
--workers
, including restarting dead ones, there's no need for Gunicorn. That also means that it's much simpler to build a Docker image from scratch now, I updated the docs to explain it.Because of that, I deprecated this Docker image: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#-warning-you-probably-dont-need-this-docker-image
I think having a custom
--root-path
is one of those cases where the combination of Uvicorn plus Gunicorn was problematic.Now building an image from scratch with Uvicorn should make it much simpler. 🤓