Skip to content

Instantly share code, notes, and snippets.

@ipcjs
Created September 29, 2018 03:13
Show Gist options
  • Save ipcjs/f4d1c7e987032379f308302e2a10953b to your computer and use it in GitHub Desktop.
Save ipcjs/f4d1c7e987032379f308302e2a10953b to your computer and use it in GitHub Desktop.
配置
# 反向代理developer.android.com, 通过本地http代理访问网站
#
# 该方式不支持通过http代理访问https网站...
# 同时, developer.android.com不支持http访问
# 故该配置用不了...
server {
listen 8880;
server_name localhost;
location / {
# 要分两步改写url, 不然nginx会直接返回302...
rewrite ^(.*)$ "://developer.android.com$1";
rewrite ^(.*)$ "http$1" break;
proxy_set_header Proxy-Connection Keep-Alive;
proxy_set_header Host developer.android.com;
# 本地http代理
proxy_pass http://127.0.0.1:1080;
# 改写重定向的url
proxy_redirect ~^https?://developer\.android\.com(.*)$ http://$host:8080$1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment