Apache as Reverse Proxy / Gateway

Discuss problems installing or using TrackStudio.

Apache as Reverse Proxy / Gateway

Postby phancox » Sat May 21, 2011 4:43 am

Can anyone help me with running TrackStudio behind an Apache Reverse Proxy / Gateway?

I want to access TS at http://trackstudio.mydomain.com when TS is actually running on http://server1.mydomain.com:8080/TrackStudio

Apache running on gateway.mydomain.com is configured with a virtual host:
Code: Select all
<VirtualHost *:80>
ServerName trackstudio.mydomain.com
ServerAlias trackstudio
RewriteEngine on
RewriteLog "/tmp/rewritelog"
RewriteLogLevel 5
RewriteRule ^/(.*) http://server1.mydomain.com:8080/TrackStudio/$1 [P]
</VirtualHost>

DNS entry for trackstudio.mydomain.com points to gateway.mydomain.com

The basics of the URL rewriting appear to be working in that I get the TS logon screen at http://trackstudio.mydomain.com but after completing the logon details I get the following stack trace (extract only).
Code: Select all
Stack Trace:
            javax.servlet.ServletException: org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
   at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
   at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
   at com.trackstudio.action.TSStrutsServlet.doGet(TSStrutsServlet.java:32)

and the URL in the browser address bar is:
Code: Select all
http://trackstudio.mydomain.com/TrackStudio/LoginAction.do;jsessionid=5FD776C14D64AF476F1615AE9771FFE3

I note also that the logon screen is missing the TrackStudio logo and some formatting (assume couldn't download CSS). Browsing the rewrite logs shows attempts to fetch the images (URL with jsessionid=729DC59C75595B6DB4A6FE9E05882BFD).

I'm guessing that this is some issue with cookies or something similar related to rewriting the URL.

Has anyone successfully used an Apache Reverse Proxy / Gateway as a front end to TS in this way?

TIA
phancox
 
Posts: 71
Joined: Mon Feb 27, 2006 1:14 pm
Location: Sydney, Australia

Re: Apache as Reverse Proxy / Gateway

Postby phancox » Sat May 21, 2011 6:36 am

Looks as if the issue was with the URL rewriting rules rather than anything to do with cookies. The "TrackStudio" portion of the URL was being inserted a second time resulting in "http://server1.mydomain.com:8080/TrackStudio/TrackStudio/....."

The virtual host definition below does almost what I want:
Code: Select all
<VirtualHost *:80>
ServerName trackstudio.mydomain.com
ServerAlias trackstudio
RewriteEngine on
#RewriteLog "/tmp/rewritelog"
#RewriteLogLevel 5
RewriteRule ^/$ /TrackStudio [R]
RewriteRule ^/TrackStudio$ /TrackStudio/ [R]
RewriteRule ^/TrackStudio/(.*) http://server1.mydomain.com:8080/TrackStudio/$1 [P]
ProxyPassReverse / http://server1.mydomain.com:8080/
</VirtualHost>

The working URL is now "http://trackstudio.mydomain.com/TrackStudio/....." I would have preferred to not have the leading "TrackStudio" in the path but couldn't get that to work.
phancox
 
Posts: 71
Joined: Mon Feb 27, 2006 1:14 pm
Location: Sydney, Australia

Re: Apache as Reverse Proxy / Gateway

Postby a-b-c » Sat May 21, 2011 8:23 pm

phancox wrote:Looks as if the issue was with the URL rewriting rules rather than anything to do with cookies. The "TrackStudio" portion of the URL was being inserted a second time resulting in "http://server1.mydomain.com:8080/TrackStudio/TrackStudio/....."

The virtual host definition below does almost what I want:
Code: Select all
<VirtualHost *:80>
ServerName trackstudio.mydomain.com
ServerAlias trackstudio
RewriteEngine on
#RewriteLog "/tmp/rewritelog"
#RewriteLogLevel 5
RewriteRule ^/$ /TrackStudio [R]
RewriteRule ^/TrackStudio$ /TrackStudio/ [R]
RewriteRule ^/TrackStudio/(.*) http://server1.mydomain.com:8080/TrackStudio/$1 [P]
ProxyPassReverse / http://server1.mydomain.com:8080/
</VirtualHost>

The working URL is now "http://trackstudio.mydomain.com/TrackStudio/....." I would have preferred to not have the leading "TrackStudio" in the path but couldn't get that to work.


There is a doc page for changing TrackStudio URL: http://www.trackstudio.com/how-change-t ... o-url.html
It seems like that's what you are looking for.
TrackStudio 4.0.14 x64
Windows SA + PostgreSQL 9.1
a-b-c
 
Posts: 560
Joined: Fri Jul 10, 2009 10:15 am
Location: Moscow, Russia

Re: Apache as Reverse Proxy / Gateway

Postby phancox » Sun May 22, 2011 5:31 am

a-b-c wrote:There is a doc page for changing TrackStudio URL: http://www.trackstudio.com/how-change-t ... o-url.html
It seems like that's what you are looking for.


Thanks for the link. That page documents how to change the URL for accessing TrackStudio on the hosting server which is not exactly the issue I was attempting to solve.

In our scenario, TrackStudio is deployed as one of many WAR files on a Tomcat server which already has Apache running on port 80. The issue I needed to solve was partially related to hiding the detail of that, but more with providing consistent URL for both intranet access and internet access via a single IP shared with other web applications. For example, internet access to SVN, TrackStudio, Jenkins, etc is all provided by svn.mydomain.com, trackstudio.mydomain.com, jenkins.mydomain.com, etc. All these DNS names map to the same IP address and Apache virtual hosts then proxy redirect to the appropriate host on our intranet. If Apache (or some other proxy) wasn't used, each of these DNS names would need to use a different port so that the router could forward packets to the correct intranet host.
phancox
 
Posts: 71
Joined: Mon Feb 27, 2006 1:14 pm
Location: Sydney, Australia

Re: Apache as Reverse Proxy / Gateway

Postby a-b-c » Sun May 22, 2011 2:32 pm

phancox wrote:
a-b-c wrote:There is a doc page for changing TrackStudio URL: http://www.trackstudio.com/how-change-t ... o-url.html
It seems like that's what you are looking for.


Thanks for the link. That page documents how to change the URL for accessing TrackStudio on the hosting server which is not exactly the issue I was attempting to solve.

In our scenario, TrackStudio is deployed as one of many WAR files on a Tomcat server which already has Apache running on port 80. The issue I needed to solve was partially related to hiding the detail of that, but more with providing consistent URL for both intranet access and internet access via a single IP shared with other web applications. For example, internet access to SVN, TrackStudio, Jenkins, etc is all provided by svn.mydomain.com, trackstudio.mydomain.com, jenkins.mydomain.com, etc. All these DNS names map to the same IP address and Apache virtual hosts then proxy redirect to the appropriate host on our intranet. If Apache (or some other proxy) wasn't used, each of these DNS names would need to use a different port so that the router could forward packets to the correct intranet host.


Yes, I understand that doc page is not about exactly your case. I mean there is a note about removing "/TrackStudio/" part from the path (http://server1.mydomain.com:8080/ instead of http://server1.mydomain.com:8080/TrackStudio/). So if you remove /TrackStudio/ part from the TrackStudio server URL then it'll be removed from the Apache vhost URL (with some changes in rewrite rules of course).
TrackStudio 4.0.14 x64
Windows SA + PostgreSQL 9.1
a-b-c
 
Posts: 560
Joined: Fri Jul 10, 2009 10:15 am
Location: Moscow, Russia

Re: Apache as Reverse Proxy / Gateway

Postby phancox » Mon May 23, 2011 3:12 am

a-b-c wrote:
phancox wrote:
a-b-c wrote:There is a doc page for changing TrackStudio URL: http://www.trackstudio.com/how-change-t ... o-url.html
It seems like that's what you are looking for.


Thanks for the link. That page documents how to change the URL for accessing TrackStudio on the hosting server which is not exactly the issue I was attempting to solve.

In our scenario, TrackStudio is deployed as one of many WAR files on a Tomcat server which already has Apache running on port 80. The issue I needed to solve was partially related to hiding the detail of that, but more with providing consistent URL for both intranet access and internet access via a single IP shared with other web applications. For example, internet access to SVN, TrackStudio, Jenkins, etc is all provided by svn.mydomain.com, trackstudio.mydomain.com, jenkins.mydomain.com, etc. All these DNS names map to the same IP address and Apache virtual hosts then proxy redirect to the appropriate host on our intranet. If Apache (or some other proxy) wasn't used, each of these DNS names would need to use a different port so that the router could forward packets to the correct intranet host.


Yes, I understand that doc page is not about exactly your case. I mean there is a note about removing "/TrackStudio/" part from the path (http://server1.mydomain.com:8080/ instead of http://server1.mydomain.com:8080/TrackStudio/). So if you remove /TrackStudio/ part from the TrackStudio server URL then it'll be removed from the Apache vhost URL (with some changes in rewrite rules of course).

Didn't really want to remove the "TrackStudio" path from server1.mydomain.com, just on the trackstudio.mydomain.com virtual host URL. Reason being that server1 is running TrackStudio as one application out of many so didn't want to put TrackStudio at the root context. There are a few ways I could achieve removing the "TrackStudio" part from the URL but most have other undesirable side effects / prerequisites. I'm not that fussed on removing the "TrackStudio" portion (i.e., can live with it and at times I think it might actually be a better implementation / convention), so I'll probably leave it as it is now for the moment.

Many thanks for your input.
phancox
 
Posts: 71
Joined: Mon Feb 27, 2006 1:14 pm
Location: Sydney, Australia


Return to TrackStudio Support

Who is online

Users browsing this forum: No registered users and 1 guest