Skip to content

Commit

Permalink
fix: add cors for nginx gotrue configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
khorshuheng committed Jan 11, 2025
1 parent 1fc8dd0 commit 1756a3b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ services:
- AI_SERVER_PORT=${AI_SERVER_PORT}
- AI_OPENAI_API_KEY=${AI_OPENAI_API_KEY}
# Uncomment this line if AppFlowy Web has been deployed
# - APPFLOWY_WEB_URL=${APPFLOWY_WEB_URL}
build:
context: .
dockerfile: Dockerfile
Expand Down
11 changes: 11 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ http {

# GoTrue
location /gotrue/ {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' $cors_origin always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Headers' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
add_header 'Access-Control-Max-Age' 3600 always;
add_header 'Content-Type' 'text/plain charset=UTF-8' always;
add_header 'Content-Length' 0 always;
return 204;
}

proxy_pass $gotrue_backend;

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

0 comments on commit 1756a3b

Please sign in to comment.