我有下面的Apache配置指令:下面阿帕奇ProxyPassMatch循环请求
ProxyPass "/info" unix:/var/run/docker.sock|http://localhost/info
ProxyPass "/version" unix:/var/run/docker.sock|http://localhost/version
ProxyPass "/containers/json" unix:/var/run/docker.sock|http://localhost/containers/json
ProxyPassMatch "^/containers/([^/]+)/json$" unix:/var/run/docker.sock|http://localhost/containers/$1/json
ProxyPass/"!"
要求正常工作:
http://server.domain/info
http://server.domain/version
http://server.domain/containers/json
但是这一次不工作:
http://server.domain/containers/asd123qwe/json
我期待ProxyPassMatch
生成如下请求:
http://localhost/containers/asd123qwe/json
配置是否可能生成循环条件? ProxyPassMatch
应该再次在Apache上生成内部请求,还是按照配置中的说明将其简单地转发到套接字?
使用log_forensic_module
我得到如下日志,这就是为什么我正在考虑一些无限循环请求作为问题。对不起,长输出!
GET /containers/f1063abfd92409/json HTTP/1.1|Host:server.domain%3a8080|Connection:keep-alive|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2|X-Forwarded-Host:server.domain%3a8080|X-Forwarded-Server:127.0.0.1|Connection:close
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2, 127.0.0.1|X-Forwarded-Host:server.domain%3a8080, localhost|X-Forwarded-Server:127.0.0.1, 127.0.0.1|Connection:close
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2, 127.0.0.1, 127.0.0.1|X-Forwarded-Host:server.domain%3a8080, localhost, localhost|X-Forwarded-Server:127.0.0.1, 127.0.0.1, 127.0.0.1|Connection:close
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2, 127.0.0.1, 127.0.0.1, 127.0.0.1|X-Forwarded-Host:server.domain%3a8080, localhost, localhost, localhost|X-Forwarded-Server:127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|Connection:close
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|X-Forwarded-Host:server.domain%3a8080, localhost, localhost, localhost, localhost|X-Forwarded-Server:127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|Connection:close
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|X-Forwarded-Host:server.domain%3a8080, localhost, localhost, localhost, localhost, localhost|X-Forwarded-Server:127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|Connection:close
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|X-Forwarded-Host:server.domain%3a8080, localhost, localhost, localhost, localhost, localhost, localhost|X-Forwarded-Server:127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|Connection:close
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|X-Forwarded-Host:server.domain%3a8080, localhost, localhost, localhost, localhost, localhost, localhost, localhost|X-Forwarded-Server:127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|Connection:close
GET /containers/f1063abfd92409/json HTTP/1.1|Host:localhost|Upgrade-Insecure-Requests:1|User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36|Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8|Accept-Encoding:gzip, deflate, sdch|Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4|X-Forwarded-For:10.255.0.2, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|X-Forwarded-Host:server.domain%3a8080, localhost, localhost, localhost, localhost, localhost, localhost, localhost, localhost|X-Forwarded-Server:127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1, 127.0.0.1|Connection:close
我不是Apache的专家,但你的正则表达式应该工作得很好,所以我建议你寻找更广泛的问题的原因。 –
@DmitryVolkov感谢您的评论,我正在努力做到这一点,但我无法找到任何有关它为什么不起作用的好解释的地方。我同意你的看法,它应该工作。 – Azize