Skip to content

Commit

Permalink
Merge pull request #49 from CS3219-AY2425S1/fix-cors
Browse files Browse the repository at this point in the history
fix syntax issues and local deployement of api gateway
  • Loading branch information
guowei42 authored Nov 12, 2024
2 parents 87d17cb + 7cc7eee commit d2cbc29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions api-gateway/api.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ server {
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization, Cookie' always;

if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 200;
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 200;
}
return 404 '{"status": 400, "message": "Bad request"}';
}

location /health {
Expand Down Expand Up @@ -101,9 +104,6 @@ server {
}


location / {
return 404 '{'status': 400, 'message': 'Bad request'}';
}

proxy_intercept_errors on;
default_type application/json;
Expand Down
12 changes: 6 additions & 6 deletions server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
ports:
- "80:80"

user:
user-service:
build:
context: ./user-service
dockerfile: Dockerfile
Expand All @@ -24,7 +24,7 @@ services:
- DB_LOCAL_URI=${DB_URI_USER}
- JWT_SECRET

questions:
qn-service:
build:
context: ./question-service
dockerfile: Dockerfile
Expand All @@ -38,7 +38,7 @@ services:
- ENV
- DB_CLOUD_URI=${DB_URI_QUESTION}

collaboration:
collab-service:
build:
context: ./collaboration-service
dockerfile: Dockerfile
Expand All @@ -56,7 +56,7 @@ services:
expose:
- 6379

matching:
match-service:
build:
context: ./matching-service
dockerfile: Dockerfile
Expand All @@ -71,7 +71,7 @@ services:
- backend
environment:
- REDIS_URL=redis://matching-redis:6379
ai:
ai-service:
build:
context: ./ai-service
dockerfile: Dockerfile
Expand All @@ -84,7 +84,7 @@ services:
environment:
- ENV
- GEMINI_API_KEY=${GEMINI_API_KEY}
chat:
chat-service:
build:
context: ./chat-service
dockerfile: Dockerfile
Expand Down

0 comments on commit d2cbc29

Please sign in to comment.