古藤君 大佬有话说 :
请教各位大佬一个nginx反代规则
本帖最后由 古藤君 于 2020-6-27 14:07 编辑
被反代站
https://api.domain.com/meta/type/attachment/274
我的网站
https://domain.com/meta/type/attachment/274
怎么访问我的网站 https://domain.com/attachment/274 获取的是反代的网站资源呢?(资源可能是json,可能是图片,可能是文件)
我的这个规则不行,访问 https://domain.com/meta/type/attachment/274 是404,百度半天规则了。特来求助
location /meta/type/attachment/ { # 把网址后面的274拿到
proxy_pass https://api.domain.com/meta/type/attachment/; # 把274拼接到proxy_pass后面
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header X-Cache $upstream_cache_status;
add_header Cache-Control no-cache;
}