nginx配置允许跨域访问
2017-10-27 09:41
841 查看
1、对外提供的查询订单信息接口需要支持跨域访问:
if ($http_origin ~* ((http|https)?://.*\.aa\.(com|hk)$)) {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type';
}2、nginx配置请求转到https
if ($http_x_proto != SSL) {
rewrite ^(.*)$ https://$host$1 permanent;
}
if ($http_origin ~* ((http|https)?://.*\.aa\.(com|hk)$)) {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type';
}2、nginx配置请求转到https
if ($http_x_proto != SSL) {
rewrite ^(.*)$ https://$host$1 permanent;
}
相关文章推荐
- Nginx允许跨域访问的配置问题
- AJAX跨域轻松配置nginx允许多个域名跨域访问
- nginx 禁止访问配置,指定URL地址指定IP允许访问
- Ngnix 配置允许多个域名跨域访问
- Nginx通过CORS配置实现跨域访问
- windows下nginx 配置代理 解决浏览器跨域访问
- C# ASP.NET MVC 配置允许跨域访问
- 阿里云服务器ECS Apache、Nginx 配置支持跨域访问
- nginx配置ssl证书,允许ssl访问
- C# ASP.NET MVC 配置允许跨域访问
- 用反向代理nginx proxy_pass配置解决ie8 ajax请求被拦截问题 ie8用nginx代理实现跨域请求访问 nginx405正向代理request_uri
- nginx配置实例:只允许内部IP访问 禁止外部访问
- NGINX的CORS--跨域访问配置
- tomcat后端允许跨域访问的配置
- nginx配置实例:只允许内部IP访问 禁止外部访问
- nginx配置允许指定域名下所有二级域名跨域请求
- Nginx,Apache只允许域名访问详细配置
- IIS、nginx、apache只允许域名访问配置
- nginx允许跨域访问
- C# ASP.NET MVC 配置允许跨域访问