Score:0

Nginx - Is there a way to apply a fail rule on a regex only if you're not within a location block?

be flag

In my nginx config I have

if ( $query_string ~ "author=([0-9]*)" ) { return 403; }

to block author queries on the frontend from leaking sensitive information. The problem is this also blocks author queries on the backend.

How can I modify this so that

/wp-admin/edit.php?something=1&author=1 //pass
/something.php?something=1&author=1 //fail

Is there a way to apply a fail rule on a regex only if you're not within a location block?

us flag
Please add the output of `nginx -T` to the question so that we can see the whole confguration. There cannot be a good answer without the full configuration.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.