Mobile app version of vmapp.org
Login or Join
Steve110

: How to redirect port 80 on server A to 443 server B I'm wondering how can use my server A to redirect different URL's to the respective server. Here is my setup: Server A: apache 2.4 on

@Steve110

Posted in: #ModProxy #ModRewrite #Redirects #UrlRewriting

I'm wondering how can use my server A to redirect different URL's to the respective server.
Here is my setup:

Server A: apache 2.4 on ubuntu 16
Server B: apache 2.4 on windows 2012

Port 80 is forwarded to server A on the firewall.
Let's say I want URL hr.xyz.com forwarded to hr.xyz.com on server B, how can I achieve this (notice change from port 80 to 443)?

I've been trying with ProxyPass & RewriteEngine (seperately, not at the same time) in my 000-default.conf but haven't had any success

ProxyPass
Server A:

<VirtualHost *:80>
ServerName hr.xyz.com
ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / ip.from.server.B:443/ ProxyPassReverse / ip.from.server.B:443/ <Location />
Order allow,deny
Allow from all
</Location>

</VirtualHost>


RewriteEngine:Server A

On server A
<VirtualHost *:80>
ServerName hr.xyz.be


RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^/?(.*)$ hr.xyz.com/ [NE,L,R=301]
</VirtualHost>


Server B:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^hr.xyz.com$ [NC]
RewriteRule ^/?(.*)$ hr.xyz.com/ [NE,L,R=301]


But I guess RewriteEngine is only meant to be configured on the same Apache server, not 2 as is my case.

Could someone advice me how to succeed please?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Steve110

1 Comments

Sorted by latest first Latest Oldest Best

 

@Steve110

I've solved this on a much simpler way than my initial thoughts. I've only used server B for this setup.

As described in the apache documentation, one can use redirect.

I added an extra virtualhost in de httpd.conf

<VirtualHost *:80>
ServerName hr.xyz.com
Redirect 301 / hr.xyz.com



This results in redirecting the url hr.xyz.com to hr.xyz.com which is exactly what I wanted!

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme