当前位置:网站首页>Realize reverse proxy client IP transparent transmission
Realize reverse proxy client IP transparent transmission
2022-07-05 23:00:00 【wwzroom】
Experimental environment :

1. modify nginx Agent profile
[[email protected]:/apps/nginx/conf.d]#
vim pc.conf
server {
listen 80;
proxy_cache off;
#proxy_cache proxycache;
#proxy_cache_key $request_uri;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 302 301 10m;
proxy_cache_valid any 5m;
add_header class M44;
add_header X-Via $server_addr;
add_header X-Cache $upstream_cache_status;
add_header X-Accel $server_name;
proxy_hide_header ETag;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Add client IP And reverse proxy IP To request message header
#listen 443 ssl;
#ssl_certificate /apps/nginx/conf.d/ssl/www.magedu.org.crt;
#ssl_certificate_key /apps/nginx/conf.d/ssl/www.magedu.org.key;
#ssl_session_cache shared:sslcache:20m;
#ssl_session_timeout 10m;
server_name www.magedu.org;
root /data/nginx/html/pc/;
location / {
root /data/nginx/html/pc/;
}
location /api {
proxy_pass http://10.0.0.8:8080/;
}
location ~* \.(jpe?g|png|bmp|gif)$ {
# Implement reverse proxy
proxy_pass http://10.0.0.28;
}
}
[[email protected]:/apps/nginx/conf.d]#
nginx -s reload
2. Add rules for viewing headers to the backend server logs . add to \"%{
X-Real-IP}i\"
[[email protected]:~]#
vim /etc/httpd/conf/httpd.conf
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{X-forwarded-for}i\" " combined
[[email protected]:~]#
systemctl restart httpd
3. Client to test
[[email protected] ~]#curl www.magedu.org/16m.jpg -I
HTTP/1.1 200 OK
Server: nginx
Date: Sun, 03 Jul 2022 01:50:18 GMT
Content-Type: image/jpeg
Content-Length: 16422438
Connection: keep-alive
Last-Modified: Sat, 02 Jul 2022 07:16:41 GMT
Accept-Ranges: bytes
class: M44
X-Via: 10.0.0.58
X-Accel: www.magedu.org
4.web Server production log
[[email protected]:~]#
tail -f /var/log/httpd/access_log
10.0.0.58 - - [03/Jul/2022:09:54:23 +0800] "HEAD /16m.jpg HTTP/1.0" 200 - "-" "curl/7.58.0" "10.0.0.100"
# Realization ip Address transmission .
边栏推荐
- Go language learning tutorial (XV)
- One article deals with the microstructure and instructions of class
- 傅里叶分析概述
- 30 optimization skills about mysql, super practical
- I closed the open source project alinesno cloud service
- Getting started stm32--gpio (running lantern) (nanny level)
- Masked Autoencoders Are Scalable Vision Learners (MAE)
- Openresty ngx Lua regular expression
- 2022 registration examination for safety management personnel of hazardous chemical business units and simulated reexamination examination for safety management personnel of hazardous chemical busines
- 2022.02.13 - SX10-30. Home raiding II
猜你喜欢

The method and principle of viewing the last modification time of the web page

Postman core function analysis - parameterization and test report

Overview of Fourier analysis

基于STM32的ADC采样序列频谱分析

LeetCode145. Post order traversal of binary tree (three methods of recursion and iteration)

My experience and summary of the new Zhongtai model

CJ mccullem autograph: to dear Portland

2022 G3 boiler water treatment simulation examination and G3 boiler water treatment simulation examination question bank

终于搞懂什么是动态规划的

Usage Summary of scriptable object in unity
随机推荐
I closed the open source project alinesno cloud service
分布式解决方案选型
傅里叶分析概述
Global and Chinese market of diesel fire pump 2022-2028: Research Report on technology, participants, trends, market size and share
Douban scoring applet Part-2
[speech processing] speech signal denoising based on Matlab GUI Hanning window fir notch filter [including Matlab source code 1711]
Tiktok__ ac_ signature
2022 registration examination for safety management personnel of hazardous chemical business units and simulated reexamination examination for safety management personnel of hazardous chemical busines
Yiwen gets rid of the garbage collector
Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
Distributed resource management and task scheduling framework yarn
TOPSIS code part of good and bad solution distance method
Leetcode daily question 1189 The maximum number of "balloons" simple simulation questions~
Binary tree (II) -- code implementation of heap
Common JVM tools and optimization strategies
Masked Autoencoders Are Scalable Vision Learners (MAE)
The difference between MVVM and MVC
openresty ngx_lua正则表达式
Fix the memory structure of JVM in one article
Business introduction of Zhengda international futures company