Is there a way to use something similar to a capture group for apache2 server name
Posted
by
Zipper
on Server Fault
See other posts from Server Fault
or by Zipper
Published on 2014-06-06T00:11:55Z
Indexed on
2014/06/06
3:27 UTC
Read the original article
Hit count: 419
I have a server that sits behind an AWS load balancer. The LB can't do automatic redirect from HTTP to HTTPs, and the LB is doing my SSL. So I need to setup apache on my servers to redirect any request on port 80 to https://FOOBAR
m where FOOBAR
is the domain that came in. I haven't been able to find a way of doing that so far. I'm an apache newb though.
What I'm trying to do is something similar to this. I'll use regex as an example
<VirtualHost *:80>
ServerName (.*)
Redirect / https://\1
</VirtualHost>
If there's a better way to do this, please let me know.
EDIT: Sorry I should have explained why this is happening. I actually have a tomcat server running my app on port 8080, and the LB points to that. From what I can tell so far my requests come in on http (which is expected), but when my app server sends redirects (for login purposes) it tries to redirect to http, instead of https. I haven't had a chance to fully investigate this, but I wanted to work around it for now by point the LB to point to the apache server, and have any port 80 requests redirect to 443.
EDIT2: The other reason I'm interested in doing this, is that since the LB can't do the redirect, I need to have another redirect mechanism in place to tell the browser to go to https://FOOBAR
© Server Fault or respective owner