Skip to content

Commit 21981ae

Browse files
committed
Merge branch 'fix/cert-cors-config' into fix/getcloser-security-config
2 parents 0883760 + aca24f3 commit 21981ae

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

cert/backend/.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# LOG_LEVEL=INFO
2+
# ENVIRONMENT=dev
3+
4+
# CORS Origins (쉼표로 구분)
5+
CORS_ORIGINS=https://cert.pseudo-lab.com,https://dev-cert.pseudolab-devfactory.com,http://localhost:5173

cert/backend/src/main.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,23 @@ def configure_logging() -> None:
4040
# Access log middleware
4141
app.middleware("http")(access_log_middleware)
4242

43-
# CORS 미들웨어 설정
44-
origins = os.getenv("CORS_ORIGINS", "").split(",")
43+
# CORS configuration
44+
# Load allowed origins from CORS_ORIGINS environment variable (comma-separated)
45+
cors_origins_str = os.getenv("CORS_ORIGINS", "")
46+
if cors_origins_str:
47+
origins = [origin.strip() for origin in cors_origins_str.split(",") if origin.strip()]
48+
else:
49+
# Default origins for local development and known production/dev domains
50+
origins = [
51+
"http://localhost:3000",
52+
"http://localhost:5173",
53+
"https://cert.pseudo-lab.com",
54+
"https://dev-cert.pseudolab-devfactory.com",
55+
]
56+
4557
app.add_middleware(
4658
CORSMiddleware,
47-
allow_origins=["*"],
59+
allow_origins=origins,
4860
allow_credentials=True,
4961
allow_methods=["*"],
5062
allow_headers=["*"],

0 commit comments

Comments
 (0)