Quick httpd redirect question
Avi Greenbury
lists at avi.co
Thu Feb 21 11:03:56 UTC 2013
Oliver Marshall wrote:
> That is, the server itself will be going to a client for testing, but they have
> DHCP only and no access to the DHCP service to assign a static IP. They also
> have no internal DNS. They work from a serviced office and the serviced office
> hardware just hands out IPs. As such the IP of the server will change every 4
> to 8 hours or so and I need the redirect to be able to redirect to whatever the
> current IP address is.
If the IP address is changing that frequently, presumably the clients
are using a DNS name of some sort to get to the server? You could just
redirect to that.
In fact, with mod_rewrite you can rewrite to "whatever they came in
requesting (%{SERVER_NAME}) but via SSL" with something like this:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*)$ https://%{SERVER_NAME}/$1 [R,L]
${SERVER_NAME} is simply the content of the host header; if the
client's requested an IP address than I think it'll be populated with
that.
--
Avi
More information about the ubuntu-users
mailing list