1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- set $_level '';
- set $_switched '';
- set $_url '';
- set $_ver '';
- set $_ref '';
- set $_type '';
- set $_mode '';
- set $_bodyhash '';
- error_page 500 502 504 /error;
- location = /error {
- internal;
- access_log off;
- more_set_headers
- 'access-control-allow-origin: *'
- 'access-control-expose-headers: gateway-err--'
- 'gateway-err--: {"msg": "$arg_msg", "addr": "$upstream_addr", "url": "$arg_url"}'
- ;
- return 204;
- }
- location = /preflight {
- internal;
- access_log off;
- more_set_headers
- 'access-control-allow-origin: *'
- 'access-control-allow-methods: GET,POST,PUT,PATCH,TRACE,DELETE,HEAD,OPTIONS'
- 'access-control-max-age: 1728000'
- ;
- return 204;
- }
- # 该接口已作废
- location = /http {
- access_log off;
- more_set_headers 'access-control-allow-origin: *';
- return 200 "该接口已作废,请更新前端脚本";
- }
- # HTTP(S) Proxy
- location /http/ {
- # see ./allowed-sites.conf
- if ($_origin_id = '') {
- rewrite ^ /error?msg=ORIGIN_NOT_ALLOWED;
- }
- if ($http_x_jsproxy) {
- rewrite ^ /error?msg=CIRCULAR_DEPENDENCY;
- }
- proxy_set_header x-jsproxy 1;
- proxy_set_header Connection $http_connection;
-
- if ($http_access_control_request_methods) {
- rewrite ^ /preflight;
- }
- access_by_lua_file ../lua/http-dec-req-hdr.lua;
- proxy_cache my_cache;
- proxy_pass $_url;
- more_set_headers
- 'server: $upstream_http_server'
- 'content-security-policy'
- 'content-security-policy-report-only'
- 'x-frame-options'
- 'alt-svc'
- 'clear-site-data'
- ;
- header_filter_by_lua_file ../lua/http-enc-res-hdr.lua;
- body_filter_by_lua_file ../lua/http-body-hash.lua;
- }
- # WebSocket Proxy
- location = /ws {
- access_by_lua_file ../lua/ws-dec-req-hdr.lua;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $http_connection;
- proxy_pass $_url;
- }
|