NGINX only for forwarding to LAN

Francis Daly francis at daoine.org
Thu Dec 12 16:36:33 UTC 2019


On Thu, Dec 12, 2019 at 11:22:10AM -0500, pixel24 wrote:

Hi there,

> in the webbrowser firefox show me the status:
> 
> connect to: http://192.168.XX.5
> 
> that can't work, can it? This address is not available in inetrnet

Quoting my previous message:

"""
If you can report a specific problem -- such as "when I do 'curl -i
http://gw.mydomain.com/dir', I get a 301 to http://192.168.xx.5/dir/
but I want a 301 to http://gw.mydomain.com/dir/", then someone may be
able to offer an improvement.
"""

Can you show the very specific request that you make, response that you
get, and response that you want instead?

Does your web service on http://192.168.XX.5 "just" serve files from
the filesystem, or does it try to do clever things with hostnames?

Depending on what else is happening, perhaps something like (again,
typed and untested):

  upstream gw.mydomain.com {
    server 192.168.XX.5;
  }
  upstream cloud.mydomain.com {
    server 192.168.XX.6;
  }
  server {
    server_name gw.mydomain.com;
    location / {
      proxy_pass http://gw.mydomain.com;
    }
  }
  server {
    server_name cloud.mydomain.com;
    location / {
      proxy_pass http://cloud.mydomain.com;
    }
  }

will get closer to what you want.

That is - using the hostname in proxy_pass means that the matching Host:
header will be sent to the upstream server; so if that server uses the
incoming name in a redirection, perhaps the right url will get back to
the client.

I think that it should not be necessary, because nginx's proxy_redirect
should have already handled it. But apparently it did not, in this case.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list