Why are all the client addresses logged in the log all proxy addresses when a proxy is hung in front of the website?

📅 2026-10-11 👁️ 15

After setting up the reverse proxy, the client addresses seen in the access logs and statistics are all the same internal network or proxy address. This is not a mistake in the log: From the perspective of the program, this TCP connection indeed comes from the proxy. The real source can only be obtained from the forwarding header, and the reliability of this header needs to be specially handled. Taking it wrong is more麻烦 than not taking it.

What does the left and right order of the address list mean

The header contains a comma-separated list of addresses. According to the document definition, the one on the right is the nearest proxy, and the one on the left claims to be the original client. With each layer of proxy, a layer is appended to the end, so the list reads from left to right as 'from the claimed source to the nearest forwarder', and the credibility increases from left to right.

This means that the two methods need to be separated: to restore the visitor's address, take the one on the leftmost side of the list; to find out who connected at this hop, take the direct address instead of the content in the header.

Why can't it be received as a whole string?

Because the client can also write this header. If the program directly trusts the entire list, an attacker can pre-load any address, causing all subsequent judgments to be false. The boundary given in the document is very direct: as long as the server can be directly connected to the public network, then no part of the list can be considered trustworthy or used for security-related purposes.

Purpose Can we use the forwarding header? Value range
Traffic and regional statistics Can be used, tolerate error Take the leftmost, allow empty
Interface speed limit Only trust the addresses appended by the trusted proxy 剥到已知代理的右边
Ban and access control by address The same, must be strict The same
Audit and traceability Need to align with gateway logs Cross-check of two-level records

Which uses can be trusted and which cannot

Statistical errors in usage affect reports and can be tolerated to a certain extent. Judgments made based on addresses for limiting speed, blocking, and preventing collection can backfire once they are incorrect: treating proxy addresses as visitors means that all site visitors share a quota; treating forged addresses as visitors means that attackers decide who to block for themselves. Therefore, the rule at this level is the same - only use the part added by trusted proxies. The method is to peel off known proxy and load balancing addresses from right to left, and the first position not on the trusted list is the actual source that is truly connected.

Three steps align on the deployment side.

The first step is to fix the link: confirm that the site can only be accessed through a proxy, the source site should not be directly exposed to the public network, otherwise the above可信 premise does not hold. The second step is to configure the trusted proxy range at the deployment layer, both Baota panel and self-built Nginx need to write in the proxy segment address, so that the program knows from which layer to start taking values; when deploying with Docker image, this layer of configuration needs to be brought in as well, and not just change the gateway. The third step is to make the logging and statistics口径 consistent: the fields used when writing and the fields used when reading must be the same, otherwise historical data cannot be compared.

When migrating data and restoring backups, this layer also needs to be checked. The backup includes static files and configurations, and after the restore, if the configuration of the trusted proxy does not come back, the logs will revert to full-screen proxy addresses, and access statistics and address-based protection will be distorted at the same time.

Common questions

Question: Why not use the real IP extension header directly?Custom headers only make sense when the link between the proxy and the origin server is completely controllable. The general practice is still to handle standard forwarding headers according to the list of trusted proxies.

Question: Will using a proxy or browser plugin by visitors cause the address to be wrong?Will. The one on the leftmost of the list is the claimed source, which may be rewritten by the client, statistics can be accepted, but security judgment cannot be accepted.

Question: Should IPv6 addresses be treated specially?Need. The trusted list and stripping logic must cover both protocol families at the same time, only writing one part will make the other part fall into the untrusted branch.

Related articles

How to match the program port and gateway port when running the website building program in the container

Containerized deployment of website programs requires three layers of ports: program listening, container mapping, and gateway outward. This article takes the default listening port as an example to explain the corresponding relationship of the three layers, typical performance when the mapping is written incorrectly, and the request headers that need to be supplemented for reverse proxy and the items that need to be checked after deployment.

2026-10-11

Where is the backend entry of the online experience station, and which capabilities should be verified during the trial?

The information and backend entry path of the experience station are written in the documentation, and the demonstration account is in the README demonstration area. This article provides a 30-minute trial list: content model and columns, AI dialogue and toolset, skill and intent directory, access and approval, included related modules, and explain which conclusions should not be obtained from the experience station.

2026-10-11

The recommended operating environment version on the official website is two levels lower than the minimum version that can run, which level should be configured?

In the same requirement page, there are often two levels of running environment numbers: one level suggests the version supported by the host, and one level is the compatible lower limit that can also run. Often followed by a sentence that these versions have entered the official discontinuation of maintenance, which may expose the site to security risks. This article explains what the two levels of numbers mean, why new sites are configured according to the recommended level, and provides a three-step order to check the language runtime, database, and transmission encryption, as well as which restrictions will disappear after switching to the compiled technology stack.

2026-10-10

Rejected upload returns 413, modify program limit first or modify gateway limit first

When the upload is rejected and returns 413, modify the limit of the gateway layer first, because this status code is returned by the front-end service and the request has not entered the program yet. The sequence is to confirm at which layer the request stops, release the request body limit of the entry layer, and then check the program's own limit. When importing large files in batches, handle them in the same order.

2026-10-10

How will the front-end sorting and push be chaotic when the scheduled publication time zone difference is taken into account

Schedule publishing so that content transitions from pending to official at the specified time. Time zone differences can cause the overall launch time to shift, which may affect the sorting of content by release time on the front end and the timing of link promotions. First, clarify the visibility scope of the three states: pending, official, and recycling bin. Then, unify the time zone standards and verify the release time together during backup and recovery.

2026-10-11

What codes should be returned for deleted articles and hidden columns, and what consequences will there be if they are all compressed into 404?

When deleting content or hiding columns, if the status code is unified to 404, the still existing paths will be read as expired. This article gives the landing points for the four types of semantics: delete, hide, reject, and exception, and explains how the recycling station, draft, and pending publication status within the site correspond to the front-end return, and attaches a list of standards for reference

2026-10-11

The large attachment upload is blocked at 413, why is it not understandable in the browser?

When uploading a large attachment, it is blocked by the gateway and returns 413. Browsers often cannot display the reason because the limit is set before the request enters the application, and the program does not have time to take over. The default limit for this type of nginx is about one megabyte, which can be set by segment according to the site and location. This article explains which segment the limit controls, why the error is difficult to read, and how to check the three types of entry points for attachment upload, batch import, and interface upload.

2026-10-11

Content security policy reports first and does not block, deciding to really block after seeing what happens

Content Security Policy runs in only-report mode first, used to collect violation records without blocking execution, which is a gray-scale method before going live with intercept rules. There are two ways to write the report target, new browsers will ignore the old address, and both should be written during the compatibility period. This article explains what types of information to look at during the gray period, when to cut off the intercept, and how to avoid a blank screen when changing the template.

2026-10-11