Skip to content

Modsec phases and Nginx phases pratice #298

Closed
@Rockybilly

Description

@Rockybilly

I am trying to create an nginx server, that uses modsecurity-nginx. But has only this specific purpose.


Return 403 if modsec applies the distruptive action 'deny', return 200 every other time, no body.


This has these two solutions (open to other suggestions).

  • Solution 1:
location / {
        modsecurity on;
        modsecurity_rules '';
        return 200;
}
  • Solution 2:
location @return200  {
        return 200;
}

location / {
        modsecurity on;
        modsecurity_rules '';
        try_files FAKE_NON_EXISTENT @return200;
}

The difference between the two is, return immediately, is a REWRITE phase directive, would this skip some of the ModSec phases?
try_files is PreContent phase, so more time given to the request before it ends? How do these correspond to ModSec processing phases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions