簡體   English   中英

Apache ProxyPassMatch循環請求

[英]Apache ProxyPassMatch loop request

我有以下有關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

做就是了:

^\/containers\/[a-zA-Z0-9_]+?\/json$

這將懶惰地匹配任何字母數字,直到下一個正斜杠/ ,這是我假設您想要的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM