In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Suppose the configuration in nginx looks like this:
Server {
Listen 80
Server_name x.x.x.x
. . . . . .
Location / subdir
{
Proxy_pass http://y.y.y.y;
}
}
Then, when the user requests http://x.x.x.x/subdir/other, matching to that block, nginx reverse proxies to the backend will retain the virtual path. The request URL that nginx actually initiates to the backend is http://y.y.y.y/subdir/other.
Suppose the configuration in nginx looks like this:
Server {
Listen 80
Server_name x.x.x.x
. . . . . .
Location / subdir
{
Proxy_pass http://y.y.y.y/;
}
}
Then, when the user requests http://x.x.x.x/subdir/other, the block is matched, and because the backend URI path is specified in the proxy_pass, the nginx agent will not retain the virtual path when it requests to the backend. The request URL that nginx actually initiates to the backend is http://y.y.y.y//other.
Suppose the configuration in nginx looks like this:
Server {
Listen 80
Server_name x.x.x.x
. . . . . .
Location / subdir
{
Proxy_pass http://y.y.y.y/upstream_subdir;
}
}
Then, when the user requests http://x.x.x.x/subdir/other, the block is matched, and because the backend URI path is specified in the proxy_pass, the nginx agent will not retain the virtual path when it requests to the backend. The request URL that nginx actually initiates to the backend is http://y.y.y.y/upstream_subdir/other.
Summing up the above three examples, we can find that the crux of the problem is whether the URI of the specified backend server is specified in the proxy_pass instruction, which determines whether the virtual path in the location will be retained when the nginx proxy requests to the backend.
When the back-end server is written in upstream mode, the effect is the same. For example:
Upstream backend {
Server y.y.y.y:80
}
Server {
Listen 80
Server_name x.x.x.x
. . . . . .
Location / subdir
{
Proxy_pass http://backend/upstream_subdir;
}
}
When a user requests a http://x.x.x.x/subdir/other, the actual request URL that the nginx initiates to the backend is still http://y.y.y.y/upstream_subdir/other.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.