V
V
Vodol2020-12-28 01:09:47
Nginx
Vodol, 2020-12-28 01:09:47

Can nginx "remember" the user?

Hello.
When the user visits the site directly, the value of $http_referer will be empty. And when he goes to the internal page of the site, $http_referer will be equal to the address of the first page. Can nginx somehow remember or tag users so that, for example, if a user initially logged in directly and then began to walk around the site, nginx understands that this is still the same user who originally had an empty referrer?

All this is necessary in order to use sub_filter to change some elements of the site depending on the value of http_referer.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Yarkov, 2020-12-28
@yarkov

Cookies

K
ky0, 2020-12-28
@ky0

This, in general, is not the task of nginx, but of the backend - to change something depending on the user. And, as correctly noted above, cookies are much more suitable for this.

G
ge, 2021-01-06
@gedev

Here the question concerns not so much the work of Nginx as the HTTP protocol. HTTP does not "remember" the client. Nginx can only record the referrer, from here you have information about where the client came from. Further on the site, the client makes a new request, which has nothing to do with the previous one. Therefore, as correctly suggested, the implementation of your task must be performed at the application level.
On my own, I’ll add that shifting part of the application’s functionality to a web server is not a good idea.

HTTP is stateless. This means that no intermediate state is stored between request-response pairs.

Poke , poke .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question