A
A
Abbadoshi2019-11-02 17:23:54
Nginx
Abbadoshi, 2019-11-02 17:23:54

How to make http_cookie work with certain content in nginx?

I'm new to the nginx theme, so don't kick me.
In general, they will go straight to the heart of the matter. There is a rule that triggers a certain setting for processing pages.
The task is to make this rule work not only with the name of the cookie, but also with its content.
Let's say the cookie "TEST" has "1" by default, but in some cases it can change to "2", how to make the rule work only with the content "1" or "2"

if ($http_cookie ~* "TEST") {

}

p.s I read the official nginx documentation, but did not understand what can be used to achieve the desired. Yes, I'm dumb)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-11-02
@Abbadoshi

$cookie_name

if ($cookie_test ~ "^(1|2)$") {

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question