I am using netlify for frontend and fastapi in the backend which is hosted in deta space. My front end is running from "https://actuallyinflint.netlify.app" but I have custom dns for "https://actuallyinflint.com"
However I keep getting the cors error but I added the origin in my backend
This is my backend origins
from starlette.middleware.cors import CORSMiddleware
origins = [
"http://localhost",
"http://localhost:3000",
"https://actuallyinflint.netlify.app/",
"https://actuallyinflint.netlify.app",
"https://actuallyinflint.com"
"https://actuallyinflint.com/"
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["GET", "POST", "OPTIONS"],
allow_headers=["*"],
)
This is the error I get in my browser
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https:myDetaSpaceHostedUrl. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 500.
The header
POST /upload/4th%20of%20July%2F HTTP/1.1
Host: myDetaSpaceHostedUrl
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Prefer: safe
Referer: https://actuallyinflint.netlify.app/
Content-Type: multipart/form-data; boundary=---------------------------396167196518845472703356094571
Content-Length: 5213567
Origin: https://actuallyinflint.netlify.app
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site