Created
January 6, 2018 08:15
-
-
Save ryanlid/9268c266db71bd7c3d3578df391c83a3 to your computer and use it in GitHub Desktop.
nginx跨域配置
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
location / { | |
root /var/www/lidong.me/www; | |
index index.html index.htm index.php; | |
# 配置允许cors跨域 | |
if ($http_origin ~ '^https?://(lidong.me)') { | |
add_header 'Access-Control-Allow-Origin' "$http_origin"; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment