使用nginx配置跨域的案例
2017-11-22 00:37
711 查看
server { listen 80; server_name grafana.test.com; #charset koi8-r; #access_log logs/host.access.log main; location / { auth_basic "Restricted"; auth_basic_user_file /opt/graphite/grafana/htpasswd/pass; if ($http_origin ~* (http://[^/]*\.test\.com)){ set $cors "true"; } if ($cors = 'true') { add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Headers X-Requested-With; add_header "Access-Control-Allow-Credentials" "true"; add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS"; add_header "Access-Control-Allow-Headers" "Authorization, origin, accept"; } root /opt/graphite/grafana; } }
相关文章推荐
- nginx 站点使用try_files配置案例
- Nginx 的使用配置并利用nginx 反向代理解决跨域问题
- 在网关中使用Nginx配置HTTP透明代理案例
- vue项目如何使用nginx配置跨域
- Nginx实现跨域使用字体文件的配置详解
- Nginx跨域使用字体文件的配置方法
- heartbeat的使用案例与图形化配置
- windows下nginx安装、配置与使用
- ubunut11.0安装nginx基本目录结构介绍和配置使用方法
- 使用passenger nginx 配置 rails 3.1 生产环境
- FastDFS的配置、部署与API使用解读(7)Nginx的FastDFS模块
- Java POI 操作Excel总结笔记--使用配置和使用案例篇
- 使用nginx配置django应用
- Windows下nginx安装、配置与使用
- nginx配置中if的使用
- nginx+php的配置(使用nginx的fastcgi模块)
- nginx使用ssl模块配置HTTPS支持
- Nginx配置使用积累[不断更新]
- Java POI 操作Excel总结笔记--使用配置和使用案例篇
- 使用Nginx如何配置Tomcat访问日志记录真实IP