sehsapneb commited on
Commit
41a7227
·
verified ·
1 Parent(s): e26a82e

Update nginx.conf

Browse files
Files changed (1) hide show
  1. nginx.conf +12 -13
nginx.conf CHANGED
@@ -12,11 +12,11 @@ server {
12
  error_log /dev/stderr info; # 保持 info 级别,方便观察
13
 
14
  location / {
15
- # 1. 改代理目标为 huggingface.co (HTTPS)
16
- proxy_pass https://huggingface.co;
17
 
18
- # 2. 更新 Host 头部以匹配新的目标
19
- proxy_set_header Host huggingface.co;
20
 
21
  # --- 保持之前尝试的浏览器伪装头部 ---
22
  proxy_set_header X-Real-IP $remote_addr;
@@ -28,21 +28,20 @@ server {
28
  proxy_set_header Accept-Encoding ""; # 保持清空,让后端决定
29
  proxy_set_header Upgrade-Insecure-Requests "1";
30
  proxy_set_header DNT "1";
31
- # proxy_set_header Referer ""; # 可以清空 Referer
32
 
33
  proxy_buffering off;
34
 
35
  proxy_ssl_server_name on;
36
  proxy_ssl_protocols TLSv1.2 TLSv1.3;
37
 
38
- # 3. 更新 proxy_redirect 和 proxy_cookie_domain 以匹配新的目标
39
- proxy_redirect ~^https://(www\.)?huggingface\.co(?<path>.*)$ https://$host${path};
40
- # 对于 huggingface.co,可能不需要处理 http 的重定向,因为它应该是全站 HTTPS
41
- # 但为了通用性,可以保留:
42
- proxy_redirect ~^http://(www\.)?huggingface\.co(?<path>.*)$ https://$host${path};
43
 
44
- proxy_cookie_domain huggingface.co $host;
45
- # huggingface.co 的 Cookie path 可能比较复杂,如果遇到登录等问题,可能需要进一步调整
 
46
  # proxy_cookie_path /some_specific_path/ /;
47
  }
48
- }
 
12
  error_log /dev/stderr info; # 保持 info 级别,方便观察
13
 
14
  location / {
15
+ # 1. 改代理 Google(HTTPS
16
+ proxy_pass https://www.google.com;
17
 
18
+ # 2. 更新 Host 头部为 Google
19
+ proxy_set_header Host www.google.com;
20
 
21
  # --- 保持之前尝试的浏览器伪装头部 ---
22
  proxy_set_header X-Real-IP $remote_addr;
 
28
  proxy_set_header Accept-Encoding ""; # 保持清空,让后端决定
29
  proxy_set_header Upgrade-Insecure-Requests "1";
30
  proxy_set_header DNT "1";
31
+ # proxy_set_header Referer ""; # 需要的话可以清空 Referer
32
 
33
  proxy_buffering off;
34
 
35
  proxy_ssl_server_name on;
36
  proxy_ssl_protocols TLSv1.2 TLSv1.3;
37
 
38
+ # 3. 更新 proxy_redirect 和 proxy_cookie_domain 为 Google
39
+ proxy_redirect ~^https://(www\.)?google\.com(?<path>.*)$ https://$host${path};
40
+ proxy_redirect ~^http://(www\.)?google\.com(?<path>.*)$ https://$host${path};
 
 
41
 
42
+ proxy_cookie_domain .google.com $host;
43
+ proxy_cookie_domain google.com $host;
44
+ # 如果后面遇到登录 / 跳转问题,再细调 path:
45
  # proxy_cookie_path /some_specific_path/ /;
46
  }
47
+ }