Hongmu Notes
Home Language Notes When using Pagoda as a reverse proxy, how does PHP obtain the domain name of the source site?
Language Notes PHP

When using Pagoda as a reverse proxy, how does PHP obtain the domain name of the source site?

When using Pagoda as a reverse proxy, how does PHP obtain the domain name of the source site?

Website: 4s5.cn

Now, I would like to access the website at 123.4s5.cn using a reverse proxy.

My current plan is to use the PHP script from 4s5.cn to retrieve the domain name 123.4s5.cn!

After extensive research, I finally discovered that when configuring reverse proxy rules, you can simply set up a rule to forward requests for 123.4s5.cn!

location / {
    proxy_pass http://4s5.cn;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    # 将 123.4s5.cn 作为请求头信息传递给目标服务器
    proxy_set_header X-Real-Domain "123.4s5.cn";
  }

Print directly in PHP即可看到你传递的值了!

$_SERVER

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

PHP ob function record

PHP ob function record Language Notes PHP

Usage of the following three functions ob_get_contents(); ob_end_clean(); ob_start(); You can use these functions to buffer local files and execute local script code. Use ob_start() to save the output code into the buffer, and the page will not be displayed; then use ob_get_contents to get the data in the buffer. o…
👁 141
PHP preg

PHP preg Language Notes PHP

The preg_match_all function is used to perform a global regular expression match. preg_match_all() Syntax int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG…
👁 169
Detailed explanation of PHP ternary operator and if

Detailed explanation of PHP ternary operator and if Language Notes PHP

Ternary operator condition ? Result 1 : Result 2 Explanation: The position in front of the question mark is the condition for judgment. If the condition is met, the result is 1, and if it is not met, the result is 2. This article compares and explains the ternary operator and if...else... in detail. I hope it will be helpful to everyone. Today when I was revising my paper online, I encountered a statement that I couldn’t understand: $if_summary = $row['IF_SUMMARY']=…
👁 189
PHP cast type

PHP cast type Language Notes PHP PHP collection PHP and mysql

Get the data type 1. If you want to check the value and type of an expression, use var_dump(). 2. If you just want to get an easy-to-read type expression for debugging, use gettype(). 3. To check a certain type, do not use gettype(), but use the is_type() function. Converting Strings to Numbers When a string is evaluated as a number, the result is determined according to the following rules...
👁 232

Recommended reading

(Adaptive mobile version) English-language foreign trade ballet shoe website – PBootCMS template; Latin dance shoe website source code download – 0644

(Adaptive mobile version) English-language foreign trade ballet shoe website – PBootCMS template; Latin dance shoe website source code download – 0644 Practical Collection pbootcms Template

An English-language PbootCMS website template for export-oriented ballet and Latin dance shoes, compatible with both PC and WAP devices. Featuring a fashionable, international design style, this template is ideal for dance shoe manufacturers to showcase their product ranges and export advantages. It helps Chinese footwear manufacturers promote their brands in overseas markets and secure international orders. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4...
👁 38
Marketing-oriented threaded screw electroplating mechanical components website template 0088

Marketing-oriented threaded screw electroplating mechanical components website template 0088 Practical Collection Yiyou template

An eYouCMS website template designed for enterprises specializing in marketing threaded screws and electroplated mechanical components. Its professional and precise design is ideal for showcasing fastener products, electroplating processes, and mechanical accessories. This template helps hardware manufacturing companies showcase their products online and attract industrial customers. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for eYouCMS | eYou...
👁 36
What should I do if the target website detects that I am using the IE browser during PHP data scraping?

What should I do if the target website detects that I am using the IE browser during PHP data scraping? Language Notes PHP PHP collection

If the target website determines your browser type by examining the User-Agent header information, you can try modifying the User-Agent header to simulate access from another browser, thereby bypassing the website's detection mechanism. In PHP, you can use the cURL library to send HTTP requests and set the User-Agent header. Here is an example code snippet: // Set the target...
👁 203
Floral and Nursery Planting & Landscape Architecture Website Template – 0712

Floral and Nursery Planting & Landscape Architecture Website Template – 0712 Practical Collection Yiyou template

An eYouCMS website template designed for the flower and nursery cultivation as well as the landscaping and garden design industries. Its natural and artistic design style is ideal for showcasing flower and nursery products, landscape design projects, greening projects, and maintenance services. This template helps landscaping companies demonstrate their expertise online and attract potential clients. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for eYouCMS...
👁 31
(PC+WAP) Atmospheric Chain Guide Rail Tensioner – Manufacturer's Website (PBootCMS Template) – Download Marketing-oriented Chain Guide Rail Website Source Code – 0032

(PC+WAP) Atmospheric Chain Guide Rail Tensioner – Manufacturer's Website (PBootCMS Template) – Download Marketing-oriented Chain Guide Rail Website Source Code – 0032 Practical Collection pbootcms Template

This PbootCMS template is designed as an official corporate website for a manufacturer specializing in chain guide rails and tensioners, and it supports both PC and mobile devices. The professional design approach with meticulous attention to detail makes it ideal for showcasing industrial transmission components. The page layout has been optimized to effectively present products and technical specifications, helping industrial manufacturing companies attract targeted online customer inquiries. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: ad...
👁 55
(Adaptive Mobile Version) pbootCMS responsive digital electronics website template – Download HTML5 smart speaker device website source code: 0645

(Adaptive Mobile Version) pbootCMS responsive digital electronics website template – Download HTML5 smart speaker device website source code: 0645 Practical Collection pbootcms Template

A responsive digital product and smart speaker website template compatible with both PC and WAP devices. Featuring a modern, tech-driven design style that showcases the functionality and aesthetic appeal of digital products, this template helps digital brands attract tech enthusiasts online and boost product sales. Template Preview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 52