SuperTron
SuperTron

Reputation: 4233

Apache2 -> Tomcat Virtual Host

I'm trying to set up an issue tracker on my server, running apache2. However, the issue tracker (youtrack) runs in tomcat, so I am trying to set up a virtual host that will redirect to the tomcat server. This is what I've got:

#Tomcat                                                                                                                                                                                                                                                                                        
<VirtualHost *:80>
    ServerName issues.example.ca
    ServerAlias issues.example.*

    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://www.example.com:8080/youtrack/
    ProxyPassReverse / http://www.example.com:8080/youtrack/
    ProxyPreserveHost On
    ProxyStatus On
    <Location />
        Order allow,deny
        Allow from all
    </Location>

    ErrorLog logs/issues.example.ca-error_log
    CustomLog logs/issues.example.ca-access_log common

</VirtualHost>

Now, I can see the youtrack login page, but without their CSS applied, and I can't log in. I poked around in the source and it turns out that it looks for all its resources in /youtrack which obviously doesnt exist because that means it would be looking in http://example.com:8080/youtrack/youtrack. How would I go about getting rid of this second youtrack path? I have tried a rewrite, but I can't quite seem to get it right. Any help would be appreciated. Thanks!

EDIT: I maanged to do a rewrite like this:

RewriteRule ^.*/youtrack/(.*)$ /$1 [P,L]

And the site works, but now the problem is that the url reads issues.example.com/youtrack/stuff and I would like it to be issues.example.com/stuff. Any ideas?

Upvotes: 1

Views: 2166

Answers (2)

SergeyZh
SergeyZh

Reputation: 36

You need to change URI on the server where YouTrack run from /youtrack to /. This is only way to achieve what you need.

Then, replace "ProxyPass / http://www.example.com:8080/youtrack/" with "ProxyPass / http://www.example.com:8080/" etc...

Upvotes: 2

pinxue
pinxue

Reputation: 1746

In past, we use modjk to bridge Apache and Tomcat.

I didn't work on this configuration for years, so that maybe there are some newer method.

Upvotes: 0

Related Questions