Answer the question
In order to leave comments, you need to log in
Does nginx create a separate tcp connection to an internal location?
Good day.
How it works:
1) The user accesses server 1 on server_name1/location1
2) It has a proxy_pass on upstream, server 2 from which sends a 302 redirect to another server_name2/location2 of server 1
3) We catch it (error_page 301 302 = @redirect; ) and send the content using the link obtained in step 2
Everything is transparent for the user, the url does not change.
In this case, nginx makes an http request to itself in step 3: server_name1/location1 -> server_name2/location2
The question is:
How does nginx access the internal location? With the creation of an additional tcp connection to itself or through internal mechanisms?
I would like to make a subrequest in server_name1/location1 to a third-party server 2, get a link and immediately make a proxy_pass for it
Answer the question
In order to leave comments, you need to log in
Thanks everyone, everything was decided by rewrite to lua and transferring server_name2/location2 to server_name1/@redirect
It's not nginx that's calling, it's the client that got the 302. Look at the logs, you can turn on the redirect trace there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question