Skip to content

Commit c617165

Browse files
fixing CORS for the production envirnment
1 parent d6b9753 commit c617165

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

backend/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@
2424

2525
# --- CORS CONFIGURATION ---
2626
# Allows your React app (running on localhost:5173) to talk to this API
27+
# --- FIXED CORS CONFIGURATION ---
2728
origins = [
28-
"http://localhost:5173", # Local development
29-
"https://arpitkumar-arpitkumar2004s-projects.vercel.app/", # Your Vercel URL
30-
"https://data-science-portfolio-website-fina.vercel.app/",
29+
"http://localhost:5173",
30+
"https://arpitkumar-arpitkumar2004s-projects.vercel.app", # Removed trailing slash
31+
"https://data-science-portfolio-website-fina.vercel.app", # Removed trailing slash
3132
]
3233

3334
app.add_middleware(
3435
CORSMiddleware,
35-
allow_origins=origins,
36+
allow_origins=origins, # Use the list variable we defined above
3637
allow_credentials=True,
3738
allow_methods=["*"],
3839
allow_headers=["*"],
40+
# Adding this helps with some browser-specific issues
41+
expose_headers=["*"],
3942
)
4043

4144
# --- Pydantic Schemas for JSON Validation ---

src/pages/Contact.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ const Contact: React.FC = () => {
5858
return () => window.removeEventListener("role:updated", onRoleUpdated);
5959
}, []);
6060

61-
// 2. Cold-Start Logic: Show notice if request takes > 8 seconds
61+
// 2. Cold-Start Logic: Show notice if request takes > 15 seconds
6262
useEffect(() => {
6363
let timer: NodeJS.Timeout;
6464
if (isSubmitting) {
65-
timer = setTimeout(() => setShowWakeUpNotice(true), 8000);
65+
timer = setTimeout(() => setShowWakeUpNotice(true), 15000);
6666
} else {
6767
setShowWakeUpNotice(false);
6868
}

0 commit comments

Comments
 (0)