@@ -52,17 +52,6 @@ http {
52
52
53
53
# GoTrue
54
54
location /gotrue/ {
55
- if ( $request_method = 'OPTIONS' ) {
56
- add_header 'Access-Control-Allow-Origin' $cors_origin always;
57
- add_header 'Access-Control-Allow-Credentials' 'true' always;
58
- add_header 'Access-Control-Allow-Headers' '*' always;
59
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
60
- add_header 'Access-Control-Max-Age' 3600 always;
61
- add_header 'Content-Type' 'text/plain charset=UTF-8' always;
62
- add_header 'Content-Length' 0 always;
63
- return 204 ;
64
- }
65
-
66
55
proxy_pass $gotrue_backend ;
67
56
68
57
rewrite ^/gotrue( /.*) $ $1 break ;
@@ -75,24 +64,6 @@ http {
75
64
76
65
# WebSocket
77
66
location /ws {
78
- # Handle preflight OPTIONS requests
79
- if ( $request_method = 'OPTIONS' ) {
80
- add_header 'Access-Control-Allow-Origin' $cors_origin always;
81
- add_header 'Access-Control-Allow-Credentials' 'true' always;
82
- add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With' always;
83
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
84
- add_header 'Access-Control-Max-Age' 1728000 always;
85
- add_header 'Content-Type' 'text/plain charset=UTF-8' always;
86
- add_header 'Content-Length' 0 always;
87
- return 204 ;
88
- }
89
-
90
- # Add CORS headers to all responses
91
- add_header 'Access-Control-Allow-Origin' $cors_origin always;
92
- add_header 'Access-Control-Allow-Credentials' 'true' always;
93
- add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With' always;
94
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
95
-
96
67
# Existing proxy configuration
97
68
proxy_pass $appflowy_cloud_backend ;
98
69
@@ -111,36 +82,11 @@ http {
111
82
proxy_set_header X-Request-Id $request_id ;
112
83
proxy_set_header Host $http_host ;
113
84
114
- # Set CORS headers for other requests
115
- if ( $request_method = 'OPTIONS' ) {
116
- add_header 'Access-Control-Allow-Origin' $cors_origin always;
117
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
118
- add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version, Device-Id' always;
119
- add_header 'Access-Control-Max-Age' 3600 always;
120
- return 204 ;
121
- }
122
-
123
- add_header 'Access-Control-Allow-Origin' $cors_origin always;
124
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
125
- add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version, Device-Id' always;
126
- add_header 'Access-Control-Max-Age' 3600 always;
127
85
128
86
location ~ * ^/api/workspace/( [a-zA-Z0-9_ -]+) /publish$ {
129
87
proxy_pass $appflowy_cloud_backend ;
130
88
proxy_request_buffering off;
131
89
client_max_body_size 256M ;
132
- if ( $request_method = 'OPTIONS' ) {
133
- add_header 'Access-Control-Allow-Origin' $cors_origin always;
134
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
135
- add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version, Device-Id' always;
136
- add_header 'Access-Control-Max-Age' 3600 always;
137
- return 204 ;
138
- }
139
-
140
- add_header 'Access-Control-Allow-Origin' $cors_origin always;
141
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
142
- add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version, Device-Id' always;
143
- add_header 'Access-Control-Max-Age' 3600 always;
144
90
}
145
91
146
92
# AppFlowy-Cloud
@@ -165,12 +111,6 @@ http {
165
111
proxy_set_header X-Request-Id $request_id ;
166
112
proxy_set_header Host $http_host ;
167
113
168
- # Handle CORS
169
- add_header 'Access-Control-Allow-Origin' $cors_origin always;
170
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
171
- add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Device-Id' always;
172
- add_header 'Access-Control-Max-Age' 3600 always;
173
-
174
114
# Timeouts
175
115
proxy_read_timeout 600s ;
176
116
proxy_connect_timeout 600s ;
0 commit comments