Merge pull request #1155 from AppFlowy-IO/add-cors-for-gotrue

fix: add cors for nginx gotrue configuration
This commit is contained in:
Khor Shu Heng 2025-01-12 00:18:06 +08:00 committed by GitHub
commit 505b4ca8fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -137,6 +137,7 @@ services:
- AI_SERVER_PORT=${AI_SERVER_PORT} - AI_SERVER_PORT=${AI_SERVER_PORT}
- AI_OPENAI_API_KEY=${AI_OPENAI_API_KEY} - AI_OPENAI_API_KEY=${AI_OPENAI_API_KEY}
# Uncomment this line if AppFlowy Web has been deployed # Uncomment this line if AppFlowy Web has been deployed
# - APPFLOWY_WEB_URL=${APPFLOWY_WEB_URL}
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile

View File

@ -49,6 +49,17 @@ http {
# GoTrue # GoTrue
location /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; proxy_pass $gotrue_backend;
rewrite ^/gotrue(/.*)$ $1 break; rewrite ^/gotrue(/.*)$ $1 break;