: 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
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?
More posts by @Steve110
1 Comments
Sorted by latest first Latest Oldest Best
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!
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.