Skip to content

ModSecurity 2.9.3 removes headers on nginx #1993

Closed
@DeoMortis

Description

@DeoMortis

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:

  1. 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.

  1. AuditLogs - nothing is shown
  2. Error logs - nothing is shown
  3. If there is a crash, the core dump file. - n/a

To Reproduce

Steps to reproduce the behavior:

  1. Have any service that returns any header not from the above list. e.g. X-Custom-Header
  2. Configure nginx to proxy_pass to that service with modsecurity enabled (no rules necessary)
  3. 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

Metadata

Metadata

Assignees

Labels

2.xRelated to ModSecurity version 2.xPlatform - NginxduplicateOps. Somebody else already hit that bumpworkaround availableThe issue has either a temporary or permanent workaround available

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions