1、跨域处理
location / { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Credentials true; ##可选 add_header Access-Control-Request-Headers custom-Key;//添加自定义请求头 add_header Access-Control-Allow-Headers DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; if ($request_method='OPTIONS'){ return 204; } }
2、跳转到https
server{ listen 80; server_name localhost; rewrite ^(.*) https://$host$1 permanent; ##跳转到https; }