Rewrite content served by apache
I have an internal app (Jira) that i want to use internally and externally, now there might be another way of doing this in which case i'm open to it, but this is what i have so far:
URL one: https://domainname.com/jira - external domain name for it
URL two: http开发者_如何学运维s://domainname.local/jira - internal network name for it.
I am running Apache as a reverse proxy and I have this:
<Location /jira>
ProxyPass http://127.0.0.1:8080/jira
ProxyPassReverse http://127.0.0.1:8080/jira
</Location>
Jira creates all of its links using a base url, which in this case is set to 'https://domainname.local/jira', so obviously when pages get served to the outside world they have .local on them.
The question is, is there a way to have the content rewritten as it is served in order to change the .local addresses within the HTML to be the .com ones?
Is there an easier way to solve this?
Cheers for any help....
Andy
What about give a unique URL to JIRA? Your users may love this!
We use this with CNames, Apache's VirtualHosts, mod_jk to jira standalone edition and reverse proxies.
HIH!
My jira runs on local:84 and this is the setup to access it as jira.yourdomain.com:
#Jira
<VirtualHost *:80>
ServerName jira.yourdomain.com
ServerAlias jira.yourdomain.com
#jirafast?
ExpiresActive On
ExpiresDefault "access plus 300 seconds"
ExpiresByType text/html "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 1 day"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
#jirafast? -
ProxyPreserveHost On
ProxyPass / http://localhost:84/
ProxyPassReverse / http://localhost:84/
<Proxy http://localhost:84/>
# Order Allow,Deny
# Allow from all
Order Deny,Allow
Allow from 127.0.0.1
</Proxy>
</VirtualHost>
If it is sub-optimal, don't be suprised, all I know is that it works
Jira will build URLs based on the URL used to access the server. In your case mod_proxy is using the proxy URL to connect.
You've got both domains proxying through to the local machine, which seems unnecessary given that the same web server is serving both domains. If you can, I'd cut out the Apache middle-man and configure both domains to point directly to Jira.
Having said that though, if you include ProxyPreserveHost On
in your config, it will persist the hostname through to the server.
精彩评论