CORS blocked with deleted frontend and nextjs app instead #1204
-
First Check
Commit to Help
Example Code
DescriptionHello Community, I was not comfortable with chakra UI so I removed the frontend like instructued in the frontend/readme.md. I swapped it out for a nextjs app. I am running the backend container in docker and the nextjs app locally (both on my server). My frontend api never reaches the fastapi backend. It's added to my .env file but I keep running into this error. Can somebody help me out or point me in the right direction? Logs: Operating SystemLinux Operating System DetailsUbuntu 22.04 Server (Remote)/ M1 Macbook (local) Python Version3.10.2 Additional ContextThankful for any help!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello there, you can start by reading the docs for CORS here: https://fastapi.tiangolo.com/tutorial/cors/ You can also read the docs about CORS in the Mozilla docs. You might want to add some logs to your backend to show the currently used CORS origins before the setup. It could be that you haven't rebuilt and restated your Docker image after changing CORS or something similar. Printing the CORS origins in your code would help you debug if the problem is before or after that point. |
Beta Was this translation helpful? Give feedback.
Hello there, you can start by reading the docs for CORS here: https://fastapi.tiangolo.com/tutorial/cors/
You can also read the docs about CORS in the Mozilla docs.
You might want to add some logs to your backend to show the currently used CORS origins before the setup. It could be that you haven't rebuilt and restated your Docker image after changing CORS or something similar. Printing the CORS origins in your code would help you debug if the problem is before or after that point.