Skip to content

Commit

Permalink
TOTAL BUG FIX OF ISSO CAN'T DISPLAY OR CORS ERROR
Browse files Browse the repository at this point in the history
  • Loading branch information
NegativeDearc committed Oct 21, 2017
1 parent b83bd9b commit da87ec7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 38 deletions.
2 changes: 1 addition & 1 deletion isso.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ name =
# http://example.tld/
# https://example.tld/
#
host = http://comment.kukumalu.cc
host = http://www.kukumalu.cc

# time range that allows users to edit/remove their own comments.
# It supports years, weeks, days, hours, minutes, seconds.
Expand Down
49 changes: 12 additions & 37 deletions isso.conf
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;
}
}
}

0 comments on commit da87ec7

Please sign in to comment.