Created
August 27, 2018 04:47
-
-
Save circlee/b3ad989a29333d043acc116941e3c80d to your computer and use it in GitHub Desktop.
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
# 특정상황시 nginx 에서 reverse-proxy 하지 않고 차단하기 위한 conf | |
server { | |
listen 80; | |
server_name test.circlee7.com; | |
charset utf-8; | |
root /home/nginx/www; | |
index index.html; | |
location / { | |
#CORS 허용을 위한 응답 해더 | |
add_header 'Access-Control-Allow-Origin' '*' always; | |
add_header 'Access-Control-Allow-Methods' 'GET, PUT, DELETE, POST, OPTIONS' always; | |
add_header 'Access-Control-Allow-Headers' '*' always; | |
if ($request_method = OPTIONS ) { | |
return 200 OK-Allowed; | |
} | |
return 490; | |
} | |
# 490 status code 에 대한 응답 페이지 처리 | |
error_page 490 /@block; | |
# error_page 490 /block.json; | |
location /@block { | |
#혹시 모를 default type 설정 | |
default_type application/json; | |
#CORS 허용을 위한 응답 해더 | |
add_header 'Access-Control-Allow-Origin' '*' always; | |
add_header 'Access-Control-Allow-Methods' 'GET, PUT, DELETE, POST, OPTIONS' always; | |
add_header 'Access-Control-Allow-Headers' '*' always; | |
# 490 = block custom status code 에 대해서는 block.json을 리턴하도록 처리 | |
try_files /block.json /block.json /block.json; | |
} | |
error_page 404 /404.html; | |
error_page 403 /403.html; | |
# static resource 로의 접근이 POST 로 요청되었을 경우의 처리 | |
error_page 405 =200 $uri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment