Skip to content

Commit 1756a3b

Browse files
committed
fix: add cors for nginx gotrue configuration
1 parent 1fc8dd0 commit 1756a3b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ services:
137137
- AI_SERVER_PORT=${AI_SERVER_PORT}
138138
- AI_OPENAI_API_KEY=${AI_OPENAI_API_KEY}
139139
# Uncomment this line if AppFlowy Web has been deployed
140+
# - APPFLOWY_WEB_URL=${APPFLOWY_WEB_URL}
140141
build:
141142
context: .
142143
dockerfile: Dockerfile

nginx/nginx.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ http {
4949

5050
# GoTrue
5151
location /gotrue/ {
52+
if ($request_method = 'OPTIONS') {
53+
add_header 'Access-Control-Allow-Origin' $cors_origin always;
54+
add_header 'Access-Control-Allow-Credentials' 'true' always;
55+
add_header 'Access-Control-Allow-Headers' '*' always;
56+
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
57+
add_header 'Access-Control-Max-Age' 3600 always;
58+
add_header 'Content-Type' 'text/plain charset=UTF-8' always;
59+
add_header 'Content-Length' 0 always;
60+
return 204;
61+
}
62+
5263
proxy_pass $gotrue_backend;
5364

5465
rewrite ^/gotrue(/.*)$ $1 break;

0 commit comments

Comments
 (0)