Skip to content

Commit 6cdc6b1

Browse files
quickdraw update
1 parent 986ab5e commit 6cdc6b1

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
FROM nginx:alpine
55

66
COPY app/ /usr/share/nginx/html
7+
COPY nginx.conf /etc/nginx/nginx.conf
78

89
EXPOSE 80
910

nginx.conf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
server {
2+
listen 80;
3+
4+
location / {
5+
root /usr/share/nginx/html;
6+
try_files $uri $uri/ /index.html;
7+
}
8+
9+
location /api/ {
10+
proxy_pass http://quickdraw-endpoints:8000/;
11+
proxy_set_header Host $host;
12+
proxy_set_header X-Real-IP $remote_addr;
13+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14+
proxy_set_header X-Forwarded-Proto $scheme;
15+
16+
# Add CORS headers
17+
add_header 'Access-Control-Allow-Origin' '*';
18+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
19+
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization';
20+
}
21+
22+
# Handle preflight requests
23+
if ($request_method = 'OPTIONS') {
24+
add_header 'Access-Control-Allow-Origin' '*';
25+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
26+
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization';
27+
return 204;
28+
}
29+
}

0 commit comments

Comments
 (0)