-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I prevent "307 Temporary Redirect" while accessing FastAPI via an Android Emulator on local machine #731
Comments
Hard to say exactly what’s going on here without more detail (eg, what are the raw 307 http response contents? what is the redirect url? what do the server request logs contain?) but my guess is something is going on with a trailing slash. Possibly your android client is modifying the url to add a trailing slash? Or maybe performing some other url modification starlette is able to handle via redirect? |
Sorry about that. Here are the details via CURL
Below is how the FastAPI server has been setup
Quite curious to know what's being missed out. |
Yeah, you can see it is trying to redirect you to the endpoint with a trailing slash:
The problem is in code you didn't share -- wherever you've defined your endpoint, the path you are providing is ending with a It works in a browser just fine because the browser is just following the redirect automatically. |
Wow, that really was the cause of the issue, indeed. After removing the trailing "/" now both the REST API Client and the Android Emulator are able to connect to the REST API. Thank you very much. This was really really helpful. Much appreciated :-) |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
The FastAPI REST API is working great when checked in the local browser and with the Advanced REST client Chrome plugin (only while using the XHR enabled).
But in no way are the same API accessible via the Android App running inside an emulator.
The info message in FastAPI console when accessed via Android App
127.0.0.1:57083 - "POST /v1/login HTTP/1.1" 307 Temporary Redirect
This is what is configured while loading the FastAPI
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: