How Can I Redirect Domain to Tomcat (localhost:8080)

Hello everyone, this has been asked before but with no clear answers. I used to have 3 websites hosted under freeBSD two with apache and one under Tomcat. I reached the one with tomcat through virtual hosts pointing to localhost:8080. I moved them to my mac to save some cash in my electricity bill but I haven't been able to figure out how to do the same under OS X Server. I know it works with the apache version that comes with OS X El Capitan but I want to use OS X Server.


Tomcat works fine, I can reach my tomcat website by typing www.mywebsite.zz:8080 or localhost:8080.

The other two websites work fine.

This is the old vhost configuration file content.


<VirtualHost *:80>

ServerName www.mywebsite.zz

ServerAlias mywebsite.zz

ProxyRequests Off

ProxyPreserveHost On

<Proxy *>

Order deny,allow

Allow from all

</Proxy>

ProxyPass / http://localhost:8080/

ProxyPassReverse / http://localhost:8080/

</VirtualHost>


I read a post where someone was suggesting to create a new website with the UI Application and a pair of .conf .plist files where the .plist file links the .conf file that contains the virtual host settings but it didn't work, the domain keeps opening the default server website.


I would really appreciate any help.

iMac, OS X El Capitan (10.11.1), 21.5 inch mid 2011 12GB RAM

Posted on Jan 26, 2016 7:38 PM

Reply
2 replies

Jan 27, 2016 2:22 AM in response to Mr__J

I don't think you need to make it this complicated. Admittedly I am not using Tomcat but I do redirect a URL from the built-in Server based Apache to a different application on the same server.


Original URL looks like this - http://myspecialserver.domain.com/

Redirecting to - http://myspecialserver.domain.com:8080/


Note: Server.app is not running a site on port 8080 this is being run by the other application in your case this would be Tomcat.


To do this


  • Edit the basic site i.e. myspecialserver.domain.com in Server.app
  • Add a Redirect rule
  • The rule should be source = / destination = http://myspecialserver.domain.com:8080/ and I use type = Permanent (301)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How Can I Redirect Domain to Tomcat (localhost:8080)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.