1

I had an Apache and Glassfish setup designed to redirect all traffic to a server or its alias to the glassfish port. This worked fine, however we required more services to be added to the server so we can't just force all traffic down one port.

What I wish to do is if users use the standard name for the server, it stays in apache but if they use the alias of the server all traffic is then routed to the glassfish port. How is this possible?

This is the current configuration

ServerName [name]
ServerAlias [alias]
SSLProxyEngine on
ProxyPreserveHost on
ProxyRequests on
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?[name] [NC]
RewriteRule (.*) https://[name]/$1 [L,R=301] 
#RewriteCond %{HTTPS} off
#ProxyPass / https://[alias]:443/
#ProxyPassReverse / https://[alias]:443/
#Redirect / https://[alias]:443/

Originally the commented lines were uncommented which forced all traffic over to 443 which then goes into the glassfish port. These lines were disabled to allow standard http traffic to work as intended

2
  • 2
    Create a new <VirtualHost>. Sep 17, 2015 at 22:41
  • I did gather that yes but can I get some more exact commands since it seems to die on me when I try Sep 17, 2015 at 22:54

1 Answer 1

0

Try rewrite [P] flag.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?[alias] [NC]
RewriteRule ^/(.*)$ https://[alias]:443/$1 [P]
ProxyPassReverse / https://[alias]:443/

rewrite proxy documentation (2.2)

2
  • Sorry for the late response but this worked after I found another issue with a config file that was breaking things. Thanks Oct 5, 2015 at 22:09
  • @AndrewGrant please add solved to this answer so the next reader can also find it.
    – Manwe
    Oct 6, 2015 at 5:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .