Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Pass the address in an X-Forwarded-For header, then have Apache’s mod_remoteip turn that trusted value into the request’s effective client address. Varnish adds its client.ip to the header when it forwards a request to a backend; Apache must be configured to trust only the Varnish address or subnet that can send the header.

The safe pattern is: establish a trusted proxy boundary in Varnish, configure Apache with RemoteIPHeader X-Forwarded-For and a narrow RemoteIPTrustedProxy list, then verify both the rewritten address and the original header in logs. Never treat an arbitrary client-supplied forwarding header as authoritative.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What happens to the client IP

When a browser connects through Varnish, Apache no longer sees the browser’s TCP connection. Apache sees a connection from Varnish, so an ordinary access log records the Varnish address unless the proxy identity is forwarded and Apache is told to use it.

The usual request path is:

  1. The client connects to Varnish. In a direct HTTP/TCP setup, client.ip is the address of that connection peer.
  2. Varnish sends the request to Apache and supplies X-Forwarded-For. Current Varnish automatically appends client.ip to that request header for backend requests.
  3. Apache’s mod_remoteip reads the header, validates the forwarding chain against its trusted-proxy configuration, and exposes the resulting address as the effective remote client address.

If another load balancer or TLS terminator is in front of Varnish, the value Varnish sees depends on that upstream connection. With PROXY protocol enabled and correctly configured, Varnish can obtain the original-client address from the metadata supplied by the upstream proxy. Without that protocol, Varnish normally sees the upstream proxy as its peer.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

Choose the forwarding method for your topology

Situation How Varnish gets the address What Apache must trust Operational concern
Client connects directly to Varnish over HTTP/TCP Varnish uses the connection peer in client.ip and forwards it in X-Forwarded-For. The Varnish source address or subnet. Ensure clients cannot bypass Varnish and reach Apache directly.
A load balancer or TLS terminator precedes Varnish and sends ordinary HTTP Varnish sees the upstream proxy’s connection address. Any existing forwarding header must be accepted only if that upstream hop is trusted. Apache still trusts Varnish; Varnish’s own boundary must decide which upstream information is authoritative. A client can forge an incoming X-Forwarded-For value unless the first trusted proxy replaces it.
An upstream proxy sends PROXY protocol to Varnish Varnish can populate client.ip from the original-client metadata carried by PROXY protocol. The Varnish source address or subnet, as in the other cases. The listener and upstream must agree on PROXY protocol; a protocol mismatch prevents reliable connections.

Use ordinary X-Forwarded-For forwarding when the HTTP proxy chain is under your control. Use PROXY protocol when a preceding load balancer must convey the original address at the transport layer and both ends support the same protocol configuration.

Configure Varnish at the trusted boundary

Rely on Varnish’s built-in forwarding

For a current Varnish installation, no custom append code is required just to pass the direct client address. Varnish automatically appends client.ip to X-Forwarded-For when creating the backend request. This behavior is the starting point for the Apache configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the header received by Apache before adding custom VCL. A hand-written append block can add the same address twice, producing a misleading chain and making troubleshooting harder.

Overwrite an untrusted incoming header

Clients can send an X-Forwarded-For header themselves. If Varnish is the first proxy you control and must discard all client-supplied values, reset the header at that boundary:

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
vcl 4.1;

sub vcl_recv {
    # Remove any client-supplied chain at the first trusted proxy.
    set req.http.X-Forwarded-For = client.ip;
}

This overwrite is appropriate only where Varnish is the trusted boundary. Do not add a second manual “append client.ip” operation on top of Varnish’s current built-in forwarding. After deploying, capture a backend request or inspect a temporary Apache log to confirm the resulting header contains the intended chain.

When an upstream proxy is present

Decide explicitly whether the upstream proxy is trusted to supply the original address. If it sends ordinary HTTP, determine which forwarding header it writes and whether Varnish should replace that header at the boundary. If it sends PROXY protocol, configure the Varnish listener and the upstream sender for that protocol and verify that client.ip changes to the original-client value. Do not assume that an address in a header is genuine merely because it came from a network device.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enable Apache’s client-address rewriting

Load mod_remoteip

Enable Apache’s mod_remoteip using the module-loading mechanism provided by your distribution. The exact command or configuration file varies by operating system, but Apache must load the module before it can process the directives below.

Set the forwarding header and trusted proxy

Add the following directives in the server or virtual-host configuration that receives requests from Varnish:

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 192.0.2.10
# Or maintain several Varnish addresses in a file:
# RemoteIPTrustedProxyList /path/to/varnish-proxies.conf

192.0.2.10 is documentation-only example space. Replace it with the actual source address used by Varnish when it connects to Apache. Do not copy that example address into production. If Varnish uses several addresses or a managed range, list the specific addresses or a deliberately scoped subnet. A maintained file is useful when the set changes; it still must contain only addresses that are allowed to present forwarding information.

Restart or gracefully reload Apache using your distribution’s normal procedure, then verify the configuration syntax before putting traffic through it. If the module is not loaded, Apache will reject or ignore the remote-IP directives rather than rewriting the application-visible address.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How Apache evaluates an X-Forwarded-For chain

Apache processes a comma-delimited X-Forwarded-For chain from right to left. It starts with the address of the immediate connection, checks whether that proxy is trusted, and walks toward the left until it reaches an address that is not trusted to present the preceding value. The first untrusted address becomes the effective client address.

This right-to-left rule is why a narrow trusted-proxy list matters. Consider a header such as:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
198.51.100.24, 203.0.113.7

If Apache’s connection is from a trusted Varnish address and the chain is valid, Apache can use the left-hand client address after processing the trusted hop. If an untrusted address appears before the claimed client, Apache stops there instead of blindly accepting the leftmost value.

Do not declare every private network or an entire internet-facing range trusted merely to make logs look correct. A host that can connect to Apache from a trusted address can potentially influence the identity Apache accepts. Keep the list limited to actual Varnish egress addresses and update it whenever those addresses change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the result before relying on it

Test the complete path in stages. The goal is to compare the raw forwarding chain with Apache’s rewritten address, not to look at one field and assume the configuration is correct.

  1. Confirm Varnish’s backend request. Use a request capture, backend diagnostic endpoint, or temporary Apache input logging to verify that Varnish sends X-Forwarded-For. Record the exact chain and the source address of the TCP connection.
  2. Confirm the module is active. Check Apache’s loaded-module list and configuration test output for mod_remoteip. A missing module means the header remains ordinary request metadata.
  3. Compare effective and raw values. Temporarily log Apache’s effective address, %a, together with the incoming X-Forwarded-For field, %{X-Forwarded-For}i. For example, a custom log format can include both fields alongside the request line:
LogFormat "%a %{X-Forwarded-For}i %r" ip_chain
CustomLog logs/access_log ip_chain

The %a value should become the client address selected by mod_remoteip; the header field shows the chain Apache received. Keep this diagnostic format temporary or protect the log because forwarding headers can contain attacker-controlled text.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
  1. Test an honest request. Connect from a known client address and confirm that the application and access log see that address rather than Varnish’s address.
  2. Test a forged header. Send a request from an untrusted client with a deliberately false X-Forwarded-For value. At the first trusted proxy, the value should be replaced or otherwise handled according to your boundary policy; Apache must not accept an arbitrary client claim as the identity.
  3. Test every ingress path. Repeat the checks for HTTP and HTTPS listeners, each load balancer, health-check path, IPv4 and IPv6 path, and any direct-to-origin route. One unprotected listener can reintroduce incorrect or spoofed addresses.
  4. Remove temporary diagnostics. Once the chain is verified, return to the normal log format or retain only the fields needed for ongoing security monitoring.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

Apache still logs the Varnish address

  • Verify that mod_remoteip is loaded and that Apache accepted the directives after a reload.
  • Check that RemoteIPHeader exactly names X-Forwarded-For; header names are not a substitute for loading the module.
  • Confirm the TCP source address reaching Apache matches a configured RemoteIPTrustedProxy entry. A NAT address, container address, or load-balancer address may differ from the address you expected.
  • Inspect the raw header. If Varnish did not send it, Apache cannot reconstruct the original client address.

The application sees an unexpected intermediate address

  • Read the chain from right to left and identify the first untrusted hop. Apache is designed to stop there.
  • Check whether a load balancer, TLS terminator, or another reverse proxy inserted an address that is not represented in the trusted topology.
  • Do not solve the symptom by trusting a broad range. Correct the chain and add only the actual proxy address that is authorized to write it.

The header contains the client address twice

  • Review VCL for a manual append operation. Current Varnish already appends client.ip for backend requests.
  • If you reset the header in vcl_recv, do not add a second custom append block. Capture the final backend request to determine whether duplication occurs in your specific Varnish version and request path.

Every request appears to come from the same upstream device

  • Determine whether Varnish is receiving a direct client connection or a connection from a preceding proxy. Without PROXY protocol, client.ip may correctly be the upstream device.
  • If the upstream is expected to provide the original address, verify that PROXY protocol is enabled on both the sender and Varnish listener, or establish a documented HTTP forwarding policy at that boundary.

Some clients show malformed or missing addresses

  • Check for multiple ingress routes that use different header names or omit forwarding entirely.
  • Inspect IPv6 formatting, NAT behavior, and health-check requests separately.
  • Confirm that no intermediary strips or rewrites X-Forwarded-For before the request reaches Apache.

Security rules for trustworthy client IPs

  • Trust the writer, not the text. An X-Forwarded-For value is authoritative only when every hop that can write it is trusted.
  • Reset at the first trusted boundary when necessary. Overwriting a client-supplied chain in Varnish prevents an untrusted caller from choosing the address Apache later consumes.
  • Keep Apache’s trust scope narrow. Use the actual Varnish source addresses or a controlled subnet, and maintain the list as infrastructure changes.
  • Block origin bypass. Firewall Apache so users cannot reach it directly and submit their own trusted-looking headers.
  • Separate identity from rate limiting. Make sure the component enforcing limits uses Apache’s rewritten address only after the proxy chain has been validated. A forged chain can otherwise let one client appear as many.
  • Protect diagnostic logs. Raw forwarding headers may include untrusted strings. Restrict access and avoid retaining temporary verbose formats longer than needed.
  • Document each hop. Record which device terminates TLS, which device speaks PROXY protocol, which address Varnish uses to reach Apache, and which addresses Apache trusts.

Operational maintenance

Recheck the configuration whenever Varnish moves hosts, gains a new egress address, changes container networking, or is placed behind a new load balancer. Update Apache’s trusted list before switching traffic; otherwise Apache will safely stop at the new untrusted hop and logs will change.

Keep a repeatable verification request for deployments. It should record the client’s known address, the Varnish-to-Apache source address, the complete X-Forwarded-For chain, and Apache’s effective %a value. Run it after module upgrades, VCL changes, listener changes, and firewall changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When investigating an incident, preserve both values: the effective address used by the application and the raw chain received from Varnish. The first explains what Apache authorized; the second shows which proxies and claimed addresses were involved.

Recommended end state

For the common direct-client-to-Varnish-to-Apache layout, leave Varnish’s automatic client.ip forwarding enabled, overwrite a client-supplied header only at the trusted Varnish boundary, load Apache’s mod_remoteip, set RemoteIPHeader X-Forwarded-For, and trust only Varnish’s real source address or subnet. If another proxy supplies the original address, make its HTTP or PROXY-protocol behavior explicit and test the entire chain. This gives applications and logs the real client address without turning a forgeable header into an unchecked identity claim.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.