Description
Describe the bug
We included modsecurity into our nginx. If only we set ModSecurityEnabled On all custom response headers are gone. The only that are left are:
- Content-Type
- Transfer-Encoding
- Connection
- Location
- Cache-Control
- Expires
- Date
- Server - this one is an empty string, doesn't occur with ModSecurityConfig Off so i seems being added by it.
Response body is fine.
Request body and headers are delivered correctly to upstream server.
Our services return a bunch of headers like:
- Custom headers like : X-Request-ID, X-XSS-Protection
- CORS headers (Access-Control-Allow-Origin, Access-Control-Expose-Headers etc)
all of them are gone.
Logs and dumps
Output of:
- DebugLogs (level 9)
[08/Jan/2019:15:19:36 +0000] [/sid#21ad2c0][rid#221cdb0][/priv-server/entity][4] Initialising transaction (txid AcgcABXHAcAcAcAcUcOcA4AS).
[08/Jan/2019:15:19:36 +0000] [/sid#21ad2c0][rid#221cdb0][/priv-server/entity][4] Transaction context created (dcfg 21adb98).
[08/Jan/2019:15:19:36 +0000] [/sid#21ad2c0][rid#221cdb0][/priv-server/entity][4] Processing disabled, skipping (hook request_early).
[08/Jan/2019:15:19:37 +0000] [/sid#21ad2c0][rid#221cdb0][/priv-server/entity][4] Initialising logging.
[08/Jan/2019:15:19:37 +0000] [/sid#21ad2c0][rid#221cdb0][/priv-server/entity][4] Starting phase LOGGING.
[08/Jan/2019:15:19:37 +0000] [/sid#21ad2c0][rid#221cdb0][/priv-server/entity][9] This phase consists of 0 rule(s).
[08/Jan/2019:15:19:37 +0000] [/sid#21ad2c0][rid#221cdb0][/priv-server/entity][4] Recording persistent data took 0 microseconds.
[08/Jan/2019:15:19:37 +0000] [/sid#21ad2c0][rid#221cdb0][/priv-server/entity][4] Audit log: Ignoring a non-relevant request.
- AuditLogs - nothing is shown
- Error logs - nothing is shown
- If there is a crash, the core dump file. - n/a
To Reproduce
Steps to reproduce the behavior:
- Have any service that returns any header not from the above list. e.g. X-Custom-Header
- Configure nginx to proxy_pass to that service with modsecurity enabled (no rules necessary)
- Call using any client e.g. curl
Expected behavior
Custom response headers should not be removed.
Server (please complete the following information):
- ModSecurity version (and connector): ModSecurity v2.9.3
- WebServer: nginx-1.11.2
- OS (and distro): Centos 7
Rule Set (please complete the following information):
- Running any public or commercial rule set? no rules
- What is the version number? - n/a
Additional context