Welcome! Log In Create A New Profile

Advanced

More than one host

Julian Brown
May 05, 2019 04:30PM
I am having a problem and not sure which side of the ocean it is on (Nginx
or Apache).

I am internally setting up an Nginx reverse proxy that will eventually go
public.

I have two domains I want Nginx to proxy for, both go to different machines.

The second domain is for a bugzilla host, bugzilla.conf:

server {
server_name bugzilla.example.com;

listen *:80;

access_log /var/log/nginx/bugzilla.access.log;
error_log /var/log/nginx/bugzilla.error.log debug;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host bugzilla.example.com;
proxy_pass https://INTERNAL_IP https://internal_ip//;
}
}

It does send the request to the correct machine, but I do not know if it is
sending the correct hostname or not.

On the machine I am sending to is an Apache instance with multiple
development versions of our server and bugzilla. The request is getting
handled by what is apparently the default vhost of the Apache server, not
the bugzilla vhost. In other words the wrong data is being sent out
because it is going to the wrong end point on Apache.

In the log for that vhost on Apache I see:

1 192.168.1.249 - - [05/May/2019:14:43:28 -0500] "GET /bugzilla/
HTTP/1.0" 200 4250 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHT
2 Execution Time 8579

the dash after 200 4250 is the 'host" I believe it is seeing or defaulting
to "-" and not http://bugzilla.example.com.

In my Nginx config I set proxy_set_header Host to what I want it to send as
bugzilla.example.com, but I am not sure what is getting sent.

Is proxy_set_header Host, the proper way to send it as "bugzilla.example.com"
so that Apache sees it coming on that server name to activate the correct
vhost?

It could be a problem in the Apache vhost config, but if I direct my
browser with /etc/hosts directly at Apache it works correctly it is only
with proxying from Nginx that I see this behavior.

Any comments?

Thanx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

More than one host

Julian Brown May 05, 2019 04:30PM

Re: More than one host

Anoop Alias May 06, 2019 08:18AM

RE: More than one host

Reinis Rozitis May 06, 2019 08:36AM

Re: More than one host

Francis Daly May 06, 2019 11:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 295
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready