Spring Apache2 背后的启动防火墙:恶意字符串“//”

Spring Boot firewall behind Apache2: malicious String "//"

我正在使用 Spring Boot fat jar 来提供后端和静态文件。我需要让它 运行 在 apache2 后面。但是我从防火墙收到“//”的恶意字符串错误:

org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String "//"
        at org.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlacklistedUrls(StrictHttpFirewall.java:369) ~[spring-security-web-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
        at org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:336) ~[spring-security-web-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:194) ~[spring-security-web-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
...

我的应用程序属性是:

server:
  port: 9001
  address: 127.0.0.1
  forward-headers-strategy: framework

而我的 apache2 虚拟主机是:

<VirtualHost *:80>
   ServerName XXX

   ProxyPreserveHost on
   RequestHeader set X-Forwarded-Proto https
   RequestHeader set X-Forwarded-Port 443
   ProxyPass / http://localhost:9001/
   ProxyPassReverse / http://localhost:9001/

   RewriteEngine on
   RewriteCond %{SERVER_NAME} =XXX
   RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

其中 "XXX" 是服务器名称。

我在这里错过了什么?我真的不想重新配置防火墙,因为我认为不改变它必须有一个解决方案。

回答我的问题:我忘记更改 ssl 配置:

<VirtualHost *:443>
  ...
</VirtualHost>

因此,如果您遇到同样的问题,可能是正确配置中缺少更改。