-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.conf
48 lines (40 loc) · 1.49 KB
/
proxy.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
client_max_body_size 2G;
underscores_in_headers on;# 支持下划线header
# 屏蔽直接访问
if ($http_user_agent !~* "WordPress|WenPai|req")
{
return 403;
}
# 对全站进行反代
location ~ ^/(http|https):/([\w\-\.\:]+)/(.*)$
{
set $remote_scheme $1;
set $remote_host $2;
set $remote_uri $3;
proxy_pass $remote_scheme://$remote_host/$remote_uri$is_args$args;
proxy_ssl_session_reuse off;
proxy_ssl_server_name on;
proxy_ssl_name "$remote_host";
proxy_http_version 1.1;
proxy_pass_request_headers on;# 传递全部header
proxy_redirect off;# 301 302跟随
proxy_connect_timeout 10s;
proxy_read_timeout 10s;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header cache-control;
proxy_set_header Host "$remote_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;
proxy_set_header Accept-Encoding "";
resolver 8.8.8.8 ipv6=off;
add_header Access-Control-Allow-Origin *;
add_header cache-control no-cache;
sub_filter_types *;
sub_filter_once off;
sub_filter "cdnjs.cloudflare.com/ajax/libs" "cdnjs.admincdn.com";
sub_filter "ajax.googleapis.com" "googleajax.admincdn.com";
sub_filter "fonts.googleapis.com" "googlefonts.admincdn.com";
sub_filter "fonts.gstatic.com" "gstatic.admincdn.com";
sub_filter $remote_scheme://$remote_host http://proxy.server/$remote_scheme://$remote_host;
}