Keep getting “307 Temporary Redirect” before returning status 200 hosted on FastAPI + uvicorn + Docker app – how to return status 200?

It happens because the exact path defined by you for your view is
yourdomainname/hello/, so when you hit it without / at the end, it first attempts to get to that path but as it is not available it checks again after appending / and gives a redirect status code 307 and then when it finds the actual path it returns the status code that is defined in the function/view linked with that path, i.e status code 200 in your case.

You can also read more about the issue here:
https://github.com/tiangolo/fastapi/issues/2060#issuecomment-834868906

Leave a Comment