fix: add production domain to CORS and update environment

- Add https://litter.psbailey.uk to CORS allowed origins
- Update CORS_ORIGIN in .env to production domain
- Update FRONTEND_URL for email links
- Support both http and https for the domain

Backend needs to be restarted after pulling this change.
This commit is contained in:
2025-11-17 01:43:09 +00:00
parent e6ee6adde5
commit 6c38df7210
2 changed files with 4 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ UPLOAD_DIR=./uploads
MAX_FILE_SIZE=5242880 MAX_FILE_SIZE=5242880
# CORS # CORS
CORS_ORIGIN=http://localhost:5173 CORS_ORIGIN=https://litter.psbailey.uk
# Redis Cache # Redis Cache
REDIS_URL="redis://localhost:6379" REDIS_URL="redis://localhost:6379"
@@ -27,5 +27,5 @@ OPENWEATHER_API_KEY="f4bd46ad4107d3ab7f688edd82a9eaa3"
AHASEND_API_KEY="aha-sk-GbzRp0nqVCgmQVw0FN47HNHdFNjR055cQCY1L-l5BSBV9_EmE1-NGHPbR2e2gaR2" AHASEND_API_KEY="aha-sk-GbzRp0nqVCgmQVw0FN47HNHdFNjR055cQCY1L-l5BSBV9_EmE1-NGHPbR2e2gaR2"
AHASEND_ACCOUNT_ID="8a14f9a5-6e6d-47c9-b5d6-a687265b36a3" AHASEND_ACCOUNT_ID="8a14f9a5-6e6d-47c9-b5d6-a687265b36a3"
FROM_EMAIL="Beach Litter Platform <noreply@psbailey.uk>" FROM_EMAIL="Beach Litter Platform <noreply@psbailey.uk>"
FRONTEND_URL="http://localhost:5173" FRONTEND_URL="https://litter.psbailey.uk"
TEST_EMAIL="psbailey31@gmail.com" TEST_EMAIL="psbailey31@gmail.com"

View File

@@ -26,6 +26,8 @@ app.use(cors({
origin: [ origin: [
'http://localhost:5173', 'http://localhost:5173',
'http://localhost:5174', 'http://localhost:5174',
'https://litter.psbailey.uk',
'http://litter.psbailey.uk',
process.env.CORS_ORIGIN || '' process.env.CORS_ORIGIN || ''
].filter(Boolean), ].filter(Boolean),
credentials: true, credentials: true,