PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, May 15, 2022

[FIXED] What is the purpose of "proxy_set_header REMOTE-HOST $remote_addr"?

 May 15, 2022     http-headers, nginx, reverse-proxy, wordpress     No comments   

Issue

I am learning to add a reverse proxy for WordPress, and in the process of referring to other people's configuration parameters, I found that someone used the following parameters in the configuration.

proxy_set_header REMOTE-HOST $remote_addr;

I tried to search the web to understand it, but I couldn't find any information about it. What exactly does it do, please?


Solution

Its purpose: It tells the reverse proxy software (nginx) to add an HTTP header to each request it forwards from your audiences' browsers to your server. The header it adds looks something like this:

REMOTE-HOST: 198.51.100.121

This header announces to your server the IP address of your audience. Without it your WordPress web server logs would show all requests coming from the proxy server's address. Which is boring and useless.

But you're doing it strangely. You should be using the X-Forwarded-For header. The nginx directive for that is

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

and in the HTTP request it looks something like this

X-Forwarded-For: 198.51.100.121

There's probably no harm in adding your REMOTE-HOST header, but the standard is X-Forwarded-For.



Answered By - O. Jones
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing