Welcome! Log In Create A New Profile

Advanced

Re: Reverse proxy redirection issue

Francis Daly
September 18, 2021 04:04AM
On Fri, Sep 17, 2021 at 10:24:44PM -0300, Daniel Armando Rodriguez wrote:

Hi there,

> I am using nginx as a reverse proxy, I managed to configure SSL certificates
> using LetsEncrypt but nginx does the redirection to the wrong vhost.
>
> This is the configuration of one of the vhost, they are 3 identical ones
> pointing to the same virtual machine. I have a fourth one pointing to
> another virtual machine that works without problems.
>
> I have the domains 1.DOMAIN.edu.ar, 2.DOMAIN.edu.ar and 3.DOMAIN.edu.ar
> pointing to the same internal IP. But any domain I enter in the browser the
> redirection is made to 1.DOMAIN.edu.ar.

I think you are reporting that if you do

curl -i http://1.DOMAIN.edu.ar

you get a http 301 redirect from nginx to https://1.DOMAIN.edu.ar (which
is what you want); and if you do

curl -i http://2.DOMAIN.edu.ar

you get a http 301 redirect from nginx to https://1.DOMAIN.edu.ar (which
is not what you want).

Is that correct?

If so...

> Also set a 4th as default_server, but behaviuor still remains.
>
> This is the vhost configuration
> ---
> # cat /etc/nginx/sites-enabled/2.DOMAIN.edu.ar.conf
> server {
> listen 80;
> server_name 2.DOMAIN.edu.ar;
> server_tokens off;
> # Don't show the nginx version number
>
> include /etc/nginx/snippets/location-letsencrypt.conf;
>
> # return 301 https://2.DOMAIN.edu.ar$request_uri;
> rewrite ^ https://2.DOMAIN.edu.ar$request_uri? permanent;
> }

....can you show the "server" blocks that have "listen 80", to make sure
that they each have the expected "server_name" values and return/rewrite
value?

The output of "nginx -T" should list the configuration that nginx actually
reads; that might be simpler to copy from than the files.


(There are other possible things to check too -- perhaps the problem is
not that "curl -i http://2.DOMAIN.edu.ar" gives the unwanted response,
but that "curl -i https://2.DOMAIN.edu.ar" gives the unwanted response. Or
perhaps the problem is that the requests are not getting to this nginx
at all. But, one step at a time, to identify where the problem is.)

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Reverse proxy redirection issue

drodriguez September 17, 2021 09:26PM

Re: Reverse proxy redirection issue

Francis Daly September 18, 2021 04:04AM

Re: Reverse proxy redirection issue

drodriguez September 18, 2021 08:18AM

Re: Reverse proxy redirection issue

Francis Daly September 19, 2021 03:02AM

Re: Reverse proxy redirection issue

drodriguez September 19, 2021 09:10PM

Re: Reverse proxy redirection issue

drodriguez September 20, 2021 10:04AM

Re: Reverse proxy redirection issue

Francis Daly September 20, 2021 12:50PM

Re: Reverse proxy redirection issue

drodriguez September 20, 2021 04:22PM

Re: Reverse proxy redirection issue

Francis Daly September 21, 2021 08:24AM

Re: Reverse proxy redirection issue

drodriguez September 21, 2021 09:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 119
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready