-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TOTAL BUG FIX OF ISSO CAN'T DISPLAY OR CORS ERROR
- Loading branch information
1 parent
b83bd9b
commit da87ec7
Showing
2 changed files
with
13 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,26 @@ | ||
|
||
server { | ||
listen 80; | ||
server_name comment.kukumalu.cc; | ||
|
||
location / { | ||
proxy_pass http://127.0.0.1:8080; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $host; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
|
||
if ($http_origin ~* (http?://(.+\.)?(kukumalu)\.(?:cc)$)) { | ||
set $origin "true"; | ||
} | ||
|
||
if ($origin = "true") { | ||
|
||
if ($request_method = 'OPTIONS') { | ||
add_header "Access-Control-Allow-Origin" "$http_origin"; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | ||
add_header 'Access-Control-Allow-Credentials' 'true'; | ||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; | ||
if ($request_method = 'OPTIONS') { | ||
add_header 'Access-Control-Allow-Origin' 'http://www.kukumalu.cc'; | ||
add_header 'Access-Control-Allow-Methods' 'HEAD, GET, POST, PUT, DELETE'; | ||
add_header 'Access-Control-Allow-Credentials' 'true'; | ||
add_header 'Access-Control-Allow-Headers' 'Origin, Referer, Content-Type'; | ||
|
||
#Tell client that this pre-flight info is valid for 20 days | ||
# Tell client that this pre-flight info is valid for 20 days | ||
|
||
add_header 'Access-Control-Max-Age' 1728000; | ||
add_header 'Content-Type' 'text/plain; charset=utf-8'; | ||
add_header 'Content-Length' 0; | ||
return 204; | ||
} | ||
|
||
if ($request_method = 'POST') { | ||
add_header "Access-Control-Allow-Origin" "$http_origin"; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | ||
add_header 'Access-Control-Allow-Credentials' 'true'; | ||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; | ||
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; | ||
} | ||
|
||
if ($request_method = 'GET') { | ||
add_header "Access-Control-Allow-Origin" "$http_origin"; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | ||
add_header 'Access-Control-Allow-Credentials' 'true'; | ||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; | ||
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; | ||
} | ||
|
||
} | ||
|
||
add_header 'Access-Control-Max-Age' 1728000; | ||
add_header 'Content-Type' 'text/plain; charset=utf-8'; | ||
add_header 'Content-Length' 0; | ||
return 204; | ||
} | ||
} | ||
} |