我想实现访问 :
http://abc.com/abc1212.txt
http://abc.com/abc3434.txt
http://abc.com/abc2626.txt
反代到 :
http://def.com/abc1212.txt
http://def.com/abc3434.txt
http://def.com/abc3434.txt
就是后面是 abc 开头,结尾不定的资源,location 搞了半天都不行,特来请教
http://def.com/xxx 等其他资源不能反代出去,只限制 abc 开头的
热议
2楼 Sing1e 5小时前
你这个应该就是域名反代就可以。
server {
listen 80;
server_nameabc.com;
location / {
proxy_pass http://def.com;
}
}
3楼 mhsl 5小时前
4楼 meta 5小时前
你这个应该就是域名反代就可以。
server {
listen 80;
不行,我没描述完,
http://def.com/xxx
不能让别人访问到
5楼 Sing1e 5小时前
不行,我没描述完,
http://def.com/xxx
不能让别人访问到
def.com都不让人访问那你怎么反代过去?
矛盾了吧。
要不在def.com里写个abc.com的白名单。
6楼 meta 5小时前
def.com都不让人访问那你怎么反代过去?
矛盾了吧。
要不在def.com里写个abc.com的白名单。 ...
def.com 是内网的,不能让别人通过 abc.com/xxx 访问到
7楼 摩卡 5小时前
location ^~ /abc {
proxy_pass
}
8楼 meta 4小时前
location ^~ /abc {
proxy_pass
}
这个是 /abc 开头的,怎么把这个传递给 proxy_pass 呢
9楼 摩卡 3小时前
这个是 /abc 开头的,怎么把这个传递给 proxy_pass 呢
匹配到的内容会全部传递给proxy
比如 /abc 前缀匹配到了/abcedf.txt 会把后面这块 /abcedf.txt 全部传给proxy
所以proxy_pass 只需要配置 http://def.com就行
申明:本文内容由网友收集分享,仅供学习参考使用。如文中内容侵犯到您的利益,请在文章下方留言,本站会第一时间进行处理。