Redirection with Reverse Proxy

Hi all,

From my main server, directly connected to the Internet, I want to redirect toto.org to a LOCAL server.

I create a redirection for toto.org pointing to https://192.168.1.200.

It looks like it redirects only http(s)://toto.org but not http(s)://www.toto.org.

If I create another redirection for www.toto.org then http(s)://www.toto.org is redirected also.

QUESTION:

Is it possible to redirect all CNAME.toto.org (www, smtp, mail, etc) with a single redirection entry ?

Any suggestion appreciated,

Michel-André

Hi all,

Ref: https://httpd.apache.org/docs/2.4/mod/core.html#serveralias
It looks like the ServerAlias *.titi.org and UseCanonicalName Off directives is one way to do it but…

For testing, on the LOCAL server (toto.org) I created a new redirection for titi.org and then modified /etc/httpd/conf.d/virtualhosts.conf of the LOCAL host toto.org i.e. 192.168.1.200.

...
# 
# Virtual Host titi.org - *:443
# Description : Testing ServerAlias

<VirtualHost *:443>

    ServerName titi.org

  ServerAlias *.titi.org
  UseCanonicalName Off
...
# 
# Virtual Host titi.org - *:80
# Description : Testing ServerAlias

<VirtualHost *:80>

    ServerName titi.org

  ServerAlias *.titi.org
  UseCanonicalName Off
...

Testing the syntax:

# httpd -t
Syntax OK

At the LOCAL server console I can ping anything like:

# ping -c 2 something.titi.org
PING something.titi.org (192.168.1.1) 56(84) bytes of data.
64 bytes from gateway (192.168.1.1): icmp_seq=1 ttl=64 time=0.526 ms
64 bytes from gateway (192.168.1.1): icmp_seq=2 ttl=64 time=2.11 ms
...

Bu it’s not the LOCAL server toto.org that is responding but the main server 192.168.1.1 .

Even if that’s the way to go, how can I implement that as /etc/httpd/conf.d/virtualhosts.conf will always be rebuild with a reboot ?

I will continue googling…

Michel-André