Apache2:html_proxy 没有启动?

Apache2:html_proxy 没有启动?

https://myserver.com/test我正在通过反向代理(外部代理到该服务器)为 Web 应用程序提供服务:8052/,我想重写 HTML 链接以使其正常运行;但它们保持原样。(Debian 11 上的 Apache 2.4.56。)

这是配置:

<Location /test>
    ProxyPass http://localhost:8052 retry=0
    ProxyPassReverse /
    SetOutputFilter proxy-html
    # disable compression so that there is no need for DEFLATE;proxy-html;INFLATE
    RequestHeader unset Accept-Encoding
    ProxyHTMLEnable On
    ProxyHTMLURLMap ^/ /test/
    LogLevel trace8
</Location>
RewriteRule ^/test$ /test/ [R]

我启用了最高级别的日志记录来查看发生了什么(下面是与该请求相关的完整日志)。当我读到它时

  1. 首先匹配 Content-type,最后到达matched 'text/html'

    好的。

  2. 然后 HTML 代理本身应该完成这项工作(重写 HTML 中的 URL)。

    但这从未发生过,日志中没有任何痕迹??

  3. 正在发送正文 ( Response sent with status 200, headers:...)

    内容包含无效链接(例如<script src="/js/vendor.js">,应<script src="/test/js/vendor.js">改为 )。

为什么跳过了 HTML 处理?

  • 我尝试手动设置ProxyHTMLLinks script src(以防 /etc/apache2/mods-enabled/proxy_html.conf 中的全局模块配置失败)。什么都没有改变。
  • 我尝试了各种其他设置(删除SetOutputFilter、删除ProxyHTMLEnable),但对输出没有影响。

任何帮助均感激不尽。

[Tue Oct 03 11:59:12.939502 2023] [proxy:trace2] [pid 4107518] mod_proxy.c(884): [client 78.108.102.144:59006] AH03461: attempting to match URI path '/test/' against prefix '/test' for proxying 
[Tue Oct 03 11:59:12.939552 2023] [proxy:trace1] [pid 4107518] mod_proxy.c(1001): [client 78.108.102.144:59006] AH03464: URI path '/test/' matches proxy handler 'proxy:http://localhost:8052/' 
[Tue Oct 03 11:59:12.939581 2023] [authz_core:debug] [pid 4107518] mod_authz_core.c(843): [client 78.108.102.144:59006] AH01628: authorization result: granted (no directives) 
[Tue Oct 03 11:59:12.939587 2023] [core:trace3] [pid 4107518] request.c(360): [client 78.108.102.144:59006] request authorized without authentication by access_checker_ex hook: /test/ 
[Tue Oct 03 11:59:12.939614 2023] [proxy_http:trace1] [pid 4107518] mod_proxy_http.c(97): [client 78.108.102.144:59006] HTTP: canonicalising URL http://localhost:8052/ 
[Tue Oct 03 11:59:12.939681 2023] [proxy:trace2] [pid 4107518] proxy_util.c(2340): [client 78.108.102.144:59006] http: found worker http://localhost:8052 for http://localhost:8052/ 
[Tue Oct 03 11:59:12.939687 2023] [proxy:debug] [pid 4107518] mod_proxy.c(1506): [client 78.108.102.144:59006] AH01143: Running scheme http handler (attempt 0) 
[Tue Oct 03 11:59:12.939693 2023] [proxy_fcgi:debug] [pid 4107518] mod_proxy_fcgi.c(1054): [client 78.108.102.144:59006] AH01076: url: http://localhost:8052/ proxyname: (null) proxyport: 0 
[Tue Oct 03 11:59:12.939698 2023] [proxy_fcgi:debug] [pid 4107518] mod_proxy_fcgi.c(1059): [client 78.108.102.144:59006] AH01077: declining URL http://localhost:8052/ 
[Tue Oct 03 11:59:12.939703 2023] [proxy_http:trace1] [pid 4107518] mod_proxy_http.c(1897): [client 78.108.102.144:59006] HTTP: serving URL http://localhost:8052/ 
[Tue Oct 03 11:59:12.939725 2023] [proxy:debug] [pid 4107518] proxy_util.c(2596): [client 78.108.102.144:59006] AH00944: connecting http://localhost:8052/ to localhost:8052 
[Tue Oct 03 11:59:12.939874 2023] [proxy:debug] [pid 4107518] proxy_util.c(2819): [client 78.108.102.144:59006] AH00947: connected / to localhost:8052 
[Tue Oct 03 11:59:12.963567 2023] [proxy_http:trace3] [pid 4107518] mod_proxy_http.c(1226): [client 78.108.102.144:59006] Status from backend: 200 
[Tue Oct 03 11:59:12.963587 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(825): [client 78.108.102.144:59006] Headers received from backend: 
[Tue Oct 03 11:59:12.963595 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(855): [client 78.108.102.144:59006] X-Powered-By: Express 
[Tue Oct 03 11:59:12.963612 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(855): [client 78.108.102.144:59006] Content-Type: text/html; charset=utf-8 
[Tue Oct 03 11:59:12.963619 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(855): [client 78.108.102.144:59006] Content-Length: 5924 
[Tue Oct 03 11:59:12.963624 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(855): [client 78.108.102.144:59006] ETag: W/"1724-Re4sPSuFqTDDg0neco8GN6drf8g" 
[Tue Oct 03 11:59:12.963629 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(855): [client 78.108.102.144:59006] Vary: Accept-Encoding 
[Tue Oct 03 11:59:12.963634 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(855): [client 78.108.102.144:59006] Date: Tue, 03 Oct 2023 09:59:12 GMT 
[Tue Oct 03 11:59:12.963647 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(855): [client 78.108.102.144:59006] Connection: keep-alive 
[Tue Oct 03 11:59:12.963652 2023] [proxy_http:trace4] [pid 4107518] mod_proxy_http.c(855): [client 78.108.102.144:59006] Keep-Alive: timeout=5 
[Tue Oct 03 11:59:12.963666 2023] [proxy_http:trace3] [pid 4107518] mod_proxy_http.c(1655): [client 78.108.102.144:59006] start body send 
[Tue Oct 03 11:59:12.964046 2023] [xml2enc:debug] [pid 4107518] mod_xml2enc.c(195): [client 78.108.102.144:59006] AH01430: Content-Type is text/html;charset=utf-8 
[Tue Oct 03 11:59:12.964069 2023] [xml2enc:info] [pid 4107518] [client 78.108.102.144:59006] AH01431: Got charset utf-8 from HTTP headers 
[Tue Oct 03 11:59:12.964359 2023] [filter:trace4] [pid 4107518] mod_filter.c(168): [client 78.108.102.144:59006] Content-Type 'text/html;charset=utf-8' ... 
[Tue Oct 03 11:59:12.964370 2023] [filter:trace4] [pid 4107518] mod_filter.c(180): [client 78.108.102.144:59006] ... did not match 'application/xml' 
[Tue Oct 03 11:59:12.964374 2023] [filter:trace2] [pid 4107518] mod_filter.c(185): [client 78.108.102.144:59006] Content-Type condition for 'deflate' did not match 
[Tue Oct 03 11:59:12.964378 2023] [filter:trace4] [pid 4107518] mod_filter.c(168): [client 78.108.102.144:59006] Content-Type 'text/html;charset=utf-8' ... 
[Tue Oct 03 11:59:12.964382 2023] [filter:trace4] [pid 4107518] mod_filter.c(180): [client 78.108.102.144:59006] ... did not match 'application/wasm' 
[Tue Oct 03 11:59:12.964385 2023] [filter:trace2] [pid 4107518] mod_filter.c(185): [client 78.108.102.144:59006] Content-Type condition for 'deflate' did not match 
[Tue Oct 03 11:59:12.964388 2023] [filter:trace4] [pid 4107518] mod_filter.c(168): [client 78.108.102.144:59006] Content-Type 'text/html;charset=utf-8' ... 
[Tue Oct 03 11:59:12.964392 2023] [filter:trace4] [pid 4107518] mod_filter.c(180): [client 78.108.102.144:59006] ... did not match 'application/rss+xml' 
[Tue Oct 03 11:59:12.964395 2023] [filter:trace2] [pid 4107518] mod_filter.c(185): [client 78.108.102.144:59006] Content-Type condition for 'deflate' did not match 
[Tue Oct 03 11:59:12.964398 2023] [filter:trace4] [pid 4107518] mod_filter.c(168): [client 78.108.102.144:59006] Content-Type 'text/html;charset=utf-8' ... 
[Tue Oct 03 11:59:12.964402 2023] [filter:trace4] [pid 4107518] mod_filter.c(180): [client 78.108.102.144:59006] ... did not match 'application/x-javascript' 
[Tue Oct 03 11:59:12.964405 2023] [filter:trace4] [pid 4107518] mod_filter.c(180): [client 78.108.102.144:59006] ... did not match 'application/javascript' 
[Tue Oct 03 11:59:12.964408 2023] [filter:trace4] [pid 4107518] mod_filter.c(180): [client 78.108.102.144:59006] ... did not match 'application/ecmascript' 
[Tue Oct 03 11:59:12.964412 2023] [filter:trace2] [pid 4107518] mod_filter.c(185): [client 78.108.102.144:59006] Content-Type condition for 'deflate' did not match 
[Tue Oct 03 11:59:12.964415 2023] [filter:trace4] [pid 4107518] mod_filter.c(168): [client 78.108.102.144:59006] Content-Type 'text/html;charset=utf-8' ... 
[Tue Oct 03 11:59:12.964418 2023] [filter:trace4] [pid 4107518] mod_filter.c(174): [client 78.108.102.144:59006] ... matched 'text/html' 
[Tue Oct 03 11:59:12.964422 2023] [filter:trace2] [pid 4107518] mod_filter.c(185): [client 78.108.102.144:59006] Content-Type condition for 'deflate' matched 
[Tue Oct 03 11:59:12.964455 2023] [http:trace3] [pid 4107518] http_filters.c(1129): [client 78.108.102.144:59006] Response sent with status 200, headers: 
[Tue Oct 03 11:59:12.964461 2023] [http:trace5] [pid 4107518] http_filters.c(1138): [client 78.108.102.144:59006]   Date: Tue, 03 Oct 2023 09:59:12 GMT 
[Tue Oct 03 11:59:12.964465 2023] [http:trace5] [pid 4107518] http_filters.c(1141): [client 78.108.102.144:59006]   Server: Apache/2.4.56 (Debian) 
[Tue Oct 03 11:59:12.964469 2023] [http:trace4] [pid 4107518] http_filters.c(959): [client 78.108.102.144:59006]   X-Powered-By: Express 
[Tue Oct 03 11:59:12.964473 2023] [http:trace4] [pid 4107518] http_filters.c(959): [client 78.108.102.144:59006]   Content-Type: text/html;charset=utf-8 
[Tue Oct 03 11:59:12.964476 2023] [http:trace4] [pid 4107518] http_filters.c(959): [client 78.108.102.144:59006]   ETag: W/\\"1724-Re4sPSuFqTDDg0neco8GN6drf8g\\" 
[Tue Oct 03 11:59:12.964502 2023] [http:trace4] [pid 4107518] http_filters.c(959): [client 78.108.102.144:59006]   Vary: Accept-Encoding 
[Tue Oct 03 11:59:12.964506 2023] [http:trace4] [pid 4107518] http_filters.c(959): [client 78.108.102.144:59006]   Content-Length: 5844 
[Tue Oct 03 11:59:12.964509 2023] [http:trace4] [pid 4107518] http_filters.c(959): [client 78.108.102.144:59006]   Keep-Alive: timeout=5, max=100 
[Tue Oct 03 11:59:12.964520 2023] [http:trace4] [pid 4107518] http_filters.c(959): [client 78.108.102.144:59006]   Connection: Keep-Alive 
[Tue Oct 03 11:59:12.964614 2023] [proxy_http:trace2] [pid 4107518] mod_proxy_http.c(1796): [client 78.108.102.144:59006] end body send 

相关内容