|
大佬帮我看下,nginx反代docker,配置cors
我的配置这样的:
- #PROXY-START/
- location ^~ /
- {
- proxy_pass http://172.17.0.2:8080;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header REMOTE-HOST $remote_addr;
- add_header Access-Control-Allow-Origin *;
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,X-Requested-With';
- add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS';
- #Persistent connection related configuration
- add_header X-Cache $upstream_cache_status;
- #Set Nginx Cache
-
-
- set $static_file8y2m6bpV 0;
- if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
- {
- set $static_file8y2m6bpV 1;
- expires 12h;
- }
- if ( $static_file8y2m6bpV = 0 )
- {
- add_header Cache-Control no-cache;
- }
- }
- #PROXY-END/
复制代码
问题出在哪儿啊 |
|