jsproxy/api.conf

57 lines
1.8 KiB
Plaintext
Raw Normal View History

2019-04-26 03:14:06 +00:00
if ($_origin_id = '') {
return 403 'ERROR: origin `$http_origin` is not allowed';
2019-04-23 04:14:27 +00:00
}
if ($http_x_jsproxy) {
return 500 'ERROR: circular dependency';
2019-04-23 04:14:27 +00:00
}
proxy_set_header x-jsproxy 1;
proxy_set_header Connection $http_connection;
2019-05-11 01:15:03 +00:00
set $_level '';
set $_switched '';
2019-04-23 04:14:27 +00:00
set $_url '';
set $_ver '';
2019-05-02 07:00:18 +00:00
set $_ref '';
2019-05-03 08:04:20 +00:00
set $_type '';
set $_mode '';
2019-04-23 04:14:27 +00:00
location = /preflight {
internal;
2019-05-03 08:04:20 +00:00
access_log off;
2019-04-23 04:14:27 +00:00
more_set_headers
'access-control-allow-origin: *'
2019-04-29 09:34:14 +00:00
'access-control-allow-methods: GET,POST,PUT,PATCH,TRACE,DELETE,HEAD,OPTIONS'
2019-05-11 01:15:03 +00:00
'access-control-allow-headers: --raw-info,--level,--url,--referer,--cookie,--origin,--ext,--aceh,--ver,--type,--mode,accept,accept-charset,accept-encoding,accept-language,accept-datetime,authorization,cache-control,content-length,content-type,date,if-match,if-modified-since,if-none-match,if-range,if-unmodified-since,max-forwards,pragma,range,te,upgrade,upgrade-insecure-requests,x-requested-with,chrome-proxy'
2019-04-23 04:14:27 +00:00
'access-control-max-age: 1728000'
;
return 204;
}
# HTTP(S) Proxy
location = /http {
2019-04-28 05:18:15 +00:00
if ($http_access_control_request_headers) {
2019-04-23 04:14:27 +00:00
rewrite ^ /preflight;
}
2019-04-29 09:34:14 +00:00
access_by_lua_file ../lua/http-dec-req-hdr.lua;
2019-04-23 04:14:27 +00:00
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'
;
2019-05-11 01:15:03 +00:00
header_filter_by_lua_file ../lua/http-enc-res-hdr.lua;
body_filter_by_lua_file ../lua/http-body-hash.lua;
2019-04-23 04:14:27 +00:00
}
# WebSocket Proxy
location = /ws {
2019-04-29 09:34:14 +00:00
access_by_lua_file ../lua/ws-dec-req-hdr.lua;
2019-04-23 04:14:27 +00:00
proxy_pass $_url;
2019-05-20 10:04:37 +00:00
}