아 nginx-fastapi CORS 어떻게 뚫었는지 좀 알려달라고 ㅠㅠ
난 사이에 nginx - gunicorn(worker로 uvicornWorker 씀) - fastapi 이렇게 되고 있는데
nginx에서
server {
listen 80;
server_name xxx.xxx.xxx.xxx;
location / {
add_header 'Access-Control-Allow-Origin' '*';
include proxy_params;
proxy_pass http://127.0.0.1:8000;
}
}
파이썬에서
from fastapi.middleware.cors import CORSMiddleware
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
이렇게 해놨는데 여전히 CORS 로 걸린다 ㅠㅠ
어디서 어디로 보내는데ㅇㅅㅇ
백엔드 서버는 오라클 무료서버 써서 거기 ip고, 프론트엔드는 그냥 집에 있는 localhost 에서 yarn start로 구동했어요
저게 백임?
네 저게 백엔드 세팅이요
Allow-Origin 이 nginx에서도 선언되있고 fastapi에서도 선언되있어서 그런듯 nginx꺼 지우셈