T
T
topconf2019-02-14 17:50:08
Nginx
topconf, 2019-02-14 17:50:08

How to replace if?

As you know, nginx does not like if
What then can replace a construction of this kind?
if ($request_method = 'POST') {
# some configuration
...
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Syomov, 2019-02-14
@kotomyava

The problem with if in the nginx config is more that developers confuse the config and their favorite programming language, and do not understand how if works in the nginx config, and what are the limitations. =)
I think it's worth reading the original source, there is both about the problem and solutions: https://www.nginx.com/resources/wiki/start/topics/...
In your case, it is quite possible that you don't need to change anything .

K
ky0, 2019-02-14
@ky0

Without fanaticism. If you do not have dozens of similar conditions, you can leave it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question