alexHX12
alexHX12

Reputation: 413

OWASP ModSecurity Docker image access forbidden for page behind Cloudfare

I'm using the latest docker image in reverse proxy mode
I keep receiving the same message 403 forbidden, I think cause the ModSecurity image try to reach the site directly with its ip and without Host header
How can I resolve?

Upvotes: 0

Views: 650

Answers (1)

Max Leske
Max Leske

Reputation: 5125

Your issue is likely with the Host header that is being set by NGiNX. If you connect to localhost, the transmitted Host header will be localhost and the receiving server will most likely not accept that.

If this is indeed your issue, then you can diagnose it by setting the Host header explicitly, and see whether that solves it. For example:

curl -H "Host: real.host.name.com" localhost:8080

Note that the container behaves as designed. However, a case could be made to support a case where all requests to the proxy use the Host header that matches the proxy target. If you feel that you need that, please open an issue on GitHub: https://github.com/coreruleset/modsecurity-docker/issues/new. We'll be happy to help.

Upvotes: 5

Related Questions