我有关于Apache配置的以下说明:
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
答案 0 :(得分:0)
只是做:
^\/containers\/[a-zA-Z0-9_]+?\/json$
这将懒惰地匹配任何字母数字,直到下一个前进色彩/
,这是我认为你想要的。