I could not call the api from my frontend

I deployed both my backend (fastapi) and frontend (react) to Render. When the frontend is in development server (localhost), I could call the deployed backend from render and download the video by calling the backend api. I set all the CORS policy

app = FastAPI()

origins = [
    "https://videodownload-frontend.onrender.com",  # replace with the origin of your frontend
]

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

also I did not specify any designated port to be called as I saw some posts from the community saying that not specifying ports could solve the issue. Since the backend api could be called in frontend localhost, I suspect it’s the problem with my deployed frontend but not backend. Do anyone have similar problem and how to solve it? thank you

for more details, i have asked on stackoverflow

Hey,

What is the issue here? Could you share the error messages you’re encountering? Please provide the steps to replicate the issue, details about your attempted solutions, and any other relevant information.

Jérémy.
Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.