The content on this page relates to platforms which are not supported for Confluence. Consequently, Atlassian can not guarantee providing any support for the steps described on this page. Please be aware that this material is provided for your information only and that you use it at your own risk. |
On this page:
There are some common situations where you might do this:
- You have an existing Apache-based website, and want to add Confluence to the mix (for example, http://www.example.com/confluence).
- You have two or more Java applications, each running in their own application server on different ports, for example, http://localhost:8090/confluence and http://localhost:8080/jira. By setting up Apache with mod_proxy, you can have both available on the regular HTTP port (80) – for example, at http://www.example.com/confluence and http://www.example.com/jira. This allows each application to be restarted, managed and debugged separately.
This page describes how to configure mod_proxy. We describe two options:
- If you want a URL like http://www.example.com/confluence/, go to the simple configuration.
- If you want a URL like http://confluence.example.com/, go to the complex configuration.
Simple configuration
Set the context path
Set your Confluence application path (the part after hostname and port) correctly. Say you want Confluence available at http://www.example.com/confluence/, and you currently have it running at http://localhost:8090/. The first step is to get Confluence available at http://localhost:8090/confluence/.
To do this in Tomcat (bundled with Confluence), edit conf/server.xml, locate the "Context" definition:
and change it to:
Then restart Confluence, and ensure you can access it at http://localhost:8090/confluence/
Configure mod_proxy
Now enable mod_proxy in Apache, and proxy requests to the application server by adding the example below to your Apache httpd.conf (note: the files may be different on your system; the JIRA docs describe the process for Ubuntu/Debian layout):
Set the URL for redirection
You will need to modify the server.xml file in your tomcat's conf directory and set the URL for redirection.
Locate this code segment
And append the following segment:
Replace www.example.com with the URL you wish to be redirected to.
If this isn't working for you, try adding a scheme attribute to your Connector tag: scheme="https". |
Set the Confluence Base URL
The last stage is to set the Base URL to the address you're using within the proxy. For example, if you're using http://www.example.com then set your Base URL to this.
Complex configuration
Complex configuration involves using the mod_proxy_html filter to modify the proxied content en-route. This is required if the Confluence path differs between Apache and the application server. For example:
Externally accessible (Apache) URL | http://confluence.example.com/ |
|---|---|
Application server URL | http://app-server.internal.example.com:8090/confluence/ |
Notice that the application path in the URL is different in each. On Apache, the path is /, and on the application server the path is /confluence.
For this configuration, you need to install the mod_proxy_html module, which is not included in the standard Apache distribution. Alternative solutions are discussed below. |
The ProxyHTMLURLMap configuration can become more complex if you have multiple applications running under this configuration. The mapping should also be placed in a Location block if the web server URL is a subdirectory and not on a virtual host. The Apache Week tutorial has more information how to do this.
Adding SSL
If you're running Apache in front of Tomcat, it's a good idea to terminate your SSL configuration at Apache, then forward the requests to Tomcat over HTTP. You can set up Apache to terminate the SSL connection and use the ProxyPass and ProxyPassReverse directives to pass the connection through to Tomcat (or the appropriate application server) which is running Confluence.
- Create a new SSL host by creating a virtual host on 443
- The standard http connection on apache could be used to redirect to https if you want or it could just be firewalled.
- Within the VirtualHost definition:
- define the SSL options (SSLEngin and SSLCertificateFile)
- define the ProxyPass and ProxyPassReverse directives to pass through to Tomcat.
Because of how the ProxyPass and ProxyPassReverse directives work, you should not need to modify the tomcat installation at all.
Most of the relevant Apache Config:
More information
- The mod_proxy_html site has documentation and examples on the use of this module in the complex configuration.
- Apache Week has a tutorial that deals with a complex situation involving two applications and ProxyHTMLURLMap.
- Using Apache with virtual hosts and mod_proxy shows how to configure the special case where you want JIRA and Confluence running on separate application servers on virtual host subdomains.
Alternatives
If Tomcat is your application server, you have two options:
- use mod_jk to send the requests to Tomcat
- use Tomcat's virtual hosts to make your Confluence application directory the same on the app server and the web server, removing the need for the URL mapping.
If your application server has an AJP connector, you can:
- use mod_jk to send the requests to your application server.







36 Comments
Hide/Show CommentsOct 10, 2006
Thomas Peter Berntsen
Hi Matt,
Thanks for some really informative articles on setting up Tomcat and HTTPD with mod_proxy and mod_proxy_html.
We've experienced some problems with the stability of this combo, though, which results in the proxying not working some time after a HTTPD start or restart.
After doing a bit investigation, we found this section in the Apache HTTPD Documentation (version 2.2 in our case), which has helped us avoid more proxy errors (http://httpd.apache.org/docs/2.2/mod/mod_proxy.html):
We have simply added
SetEnv force-proxy-request-1.0 1andSetEnv proxy-nokeepalive 1to the<VirtualHost>directive inhttpd.conf(or included configuration file) under which proxying should be perfomed and gone are any signs of mysterious proxy errorsCheers,
Thomas
Oct 10, 2006
Ivan Benko
Thanks Thomas for your effort and the information provided.
Ivan
Oct 03, 2007
Anonymous
Hi,
I would like to change URL path (http://localhost:8080/confluence to http://localhost/wiki) but I never doing that. I'm absolutely crazy, could you check where I am doing mistake?
PS: There is no any Apache Tomcat installation. The system working with http://localhost/confluence URL properly.
Apache 2.2.6 X86
confluence-std-2.6.0
Win Environment CATALINA_HOME = D:\confluence\confluence-std-2.6.0
Thanks,
Oguz Celikdemir
CONFIG INFOS:
Apache httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
# Confluence configuration
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /confluence http://localhost:8080/wiki
ProxyPassReverse /confluence http://localhost:8080/wiki
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
<Location /confluence>
Order allow,deny
Allow from all
</Location>
Confluence confluence-init.properties
confluence.home=d:/confluence/data
Confluence server.xml
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxHttpHeaderSize="8192"
maxProcessors="75" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" disableUploadTimeout="true"
enableLookups="false" redirectPort="8444" acceptCount="10" debug="0" connectionTimeout="20000"
useURIValidationHack="false" URIEncoding="UTF-8"
proxyName="localhost" proxyPort="80"/>
<Context path="/wiki" docBase="../confluence" debug="0" reloadable="false">
Oct 24, 2007
Luis Arias
I had to use the following setup with confluence 2.6 and Apache 2.2 because style sheets were being prefixed with /confluence and didn't show up:
NameVirtualHost *
<VirtualHost *>
ServerName wiki.example.com
<IfModule proxy_module>
<Proxy *>
Order deny,allow
Allow from *
</Proxy>
<IfModule proxy_ajp_module>
ProxyPass /confluence/ ajp://localhost:8009/confluence/
ProxyPassReverse /confluence/ ajp://localhost:8009/confluence/
ProxyPass / ajp://localhost:8009/confluence/
ProxyPassReverse / ajp://localhost:8009/confluence/
</IfModule>
<Location />
Order allow,deny
Allow from all
</Location>
</IfModule>
</VirtualHost>
Nov 25, 2007
Anonymous
Hi Guys,
I have a client using Apache 1.3.xx and am wondering if you have any documentation on this or could help me with proxying Confluence through Apache 1.3?
Any help or pointers would be greatly appreciated.
Regards,
Roger
Jun 06, 2011
Tony Cheah Tong Nyee
Hi Roger,
Unfortunately, I am not aware of any documentation specific to Apache 1.3 is available here. Perhaps, you may want to give a try to refer to the documentation available in the Apache documentation as a reference:
Another option would be to try open a discussion on Atlassian Answers, as there might have users/developers who have experience in similar environment might share their idea with you.
Cheers,
Tony
Nov 29, 2007
Anonymous
Hi Tony,
I've upgraded to apache version 2, and used Luis Arias Virtual host config (slightly changed) as this was the only way I could get the CSS to come through correctly.
I now have the problem where I enter valid login details, then click login, but it returns me to the login screen, all at http://confluence.example.com\\
When I try the same test at http://confluence.example.com:8080/confluence I can login using the same details as I used above, and it takes me to the dashboard.
Has anyone else come across this?
Roger
Mar 14, 2008
Tony Cheah Tong Nyee
Hi Roger,
Feel free to raise a support request regarding this issue if you still require any assistance from us. From there, we are able to troubleshoot and look into this issue further.
Cheers,
Tony
Jan 13, 2008
Anonymous
After hours of fiddling around I finaly got it working. I wrote it down in my own confluence instance, so I just copied it here. I hope this helps someone in the future.
Greetz Erik
Table of Contents
Description
On your J2EE server (I only used Glassfish) you have an application deployed, for instance 'confluence-2.7'. The default way of accessing this web application is by going to the url 'http://localhost:8080/confluence-2.7'. I however wanted to map just have the url 'http://confluence' for easy development access. In the future I want to be able to connect domains to it.
If you are impatient and do not want to do things step by step you can find a Summary at the bottom of this page.
Getting the correct modules for apache
We need to do the following things:
Proxying requests
You will need to enable the following lines in your
httpd.conf:To make sure proxying is enabled add the following lines to you
httpd.conf(I added them at the top ofhttpd-vhosts.conf):The virtual host itself looks like this:
Add the following lines:
Correcting the HTML
In order to correct the html we need a module called mod_proxy_html. You can not download a compiled version for free from the original site so I included a windows version here: http://www.apachelounge.com/download/mods/mod_proxy_html-3.0.0-w32.zip.
Extract the
mod_proxy_htmldirectory to themodulesdirectory of apache. Also copy theproxy_html.conffile to that directory.Make sure the following line is enabled:
At the bottom of the modules list in your httpd.conf add the following lines:
In the virtual host we add the following lines:
Fixing cookies
In order to fix the cookies you need to add the following line to your VirtualHost:
Summary
Make sure you have mod_proxy_html
These are the lines we added to our httpd.conf:
This is our VirtualHost:
Feb 08, 2008
Ludovic Lambert
Miss
Apr 23, 2008
Anonymous
Configuration with SSL appears here: http://confluence.atlassian.com/display/DOC/Adding+SSL+for+Secure+Logins+and+Page+Security?focusedCommentId=18579545#comment-18579545
You may have to turn ProxyPreserveHost to OFF to get SSL working.
Feb 04, 2011
Anonymous
Thank You! That fixed it on our end for SSL. coolPoints++
Jun 11, 2008
Anonymous
With Apache 2.2.3 (Red Hat), I can't get reverse proxy to work... First problem, is that the server.xml file in conflence 2.8.1 doesn't match the documentation found above. So I may be confused there.
I am able to get things to work when I point to alpha.uarts.edu:8080, but when i go to server.xml and add the line
and then add the following to httpd.conf
I am receiving Apache 503 errors.
This is a brand new install of RHEL5 that I'm using to host confluence (and other things later on) so I know that nothing else is conflicting.
Its infact the production server 'to-be' of confluence, now that our evaluation is winding down, and I'm following the same methodology I used to get Confluence 2.6 running (with no problems).
If anyone has installed 2.8.1 and can share with me their connection block from server.xml, I'd appreciate it.
Thanks
Jun 11, 2008
Anonymous
Here is the relevent parts of server.xml that I edited.
Jun 11, 2008
Duran Goodyear
I think I can blame SELINUX.
I set it to disabled, and now have a new problem...
it took 451 seconds for the standalone tomcat to finish starting, and it gave me this nasty error in catalina.out
INFO: Server startup in 455491 ms Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2" java.lang.NullPointerException at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.isLoggable(Log4jMLog.java:257) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:551) Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0" java.lang.NullPointerException at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.isLoggable(Log4jMLog.java:257) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:551) Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2" java.lang.NullPointerException at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.isLoggable(Log4jMLog.java:257) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:551) Exception in thread "Timer-1" java.lang.NullPointerException at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.isLoggable(Log4jMLog.java:257) at com.mchange.v2.resourcepool.BasicResourcePool$CheckIdleResourcesTask.run(BasicResourcePool.java:1961) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Exception in thread "Timer-0" java.lang.NullPointerException at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.isLoggable(Log4jMLog.java:257) at com.mchange.v2.resourcepool.BasicResourcePool$CullTask.run(BasicResourcePool.java:1934) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462)and the browser, when I try to load the page says...
I'm going to go try and get it working in standalone mode only through port 8080, and work my way back, but this looks like a tomcat configuration issue.
Any thoughts anyone?
Thanks
Jun 11, 2008
Duran Goodyear
Alrighty, this was a SELINUX issue.
I had to disable it, and it absolutely destroyed what ever other permission structure existed.
I had to reinstall confluence completely.
Protip, avoid SELINUX
(thats just my own fud, ymmv)
Aug 26, 2008
Anonymous
HELP!!
I appear to be having similar issues to one of the above posts. I am running confluence 2.9 on Red Hat ES 5.1 with Apache 2.2. I continue to get a 503 error when trying to connect. I was trying the complex config with the URL re-mapping, but I scaled back and decided to do a simple port URL redirection and I am still getting a 503 error. I have scoured this site and tried every variation I can think of. Does any one have any ideas?? I have the following httpd.conf entry:
ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:80>
ServerName confluence.domain.com
# Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts)
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://confluence-server.domain.com:8080/
ProxyPassReverse / http://confluence-server.domain.com:8080/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
Aug 26, 2008
Anonymous
Found the solution for 503 errors if anyone is running newer version of SELinux or Red Hat ES. It has to do with network permission for httpd. You will probably see log entries like the following:
<pre>[Thu Jul 09 11:37:13 2008] [error] (13)Permission denied: proxy: HTTP: attempt to connect to 127.0.0.1:3000
failed
I found a post online that requires granting the httpd service network rights using the following command:
/usr/sbin/setsebool httpd_can_network_connect 1
This solved my problems. Hope this helps others...
May 16, 2011
Anonymous
thank you very much!!! it was very helpful!!
Mar 25, 2009
Royce Wong
This documentation does not indicate which version of Apache it is referencing. If you look at the doc. for JIRA/Apache integration, it says:
Therefore, if you are running Apache 2, you do not need to add proxyName="www.example.com" proxyPort="80" in Tomcat's server.xml.I tested mine with Tomcat 5.5.27, Apache 2 on Windows XP and it works. I configured Confluence to use port 8280 & JIRA to use port 8180 running on seperate Tomcats (seperate JVMs). My httpd.conf looks like this:
So I can access my Confluence via: *http://localhost/confluence\* (http://localhost/confluence*) and JIRA via: *http://localhost/jira\* (http://localhost/jira*), all on one machine and I can start/stop Confluence & JIRA independently since they are on seperate Tomcat..
Feb 16, 2011
Anonymous
quit right!
If you proxyName="www.example.com" proxyPort="80" in Tomcat's server.xml, you will get 503 error
Jun 01, 2009
Anonymous
Hi,
Problem(Abstract)
A Proxy Error in Apache HTTP Server causes a 502 error response in the browser.
Symptom
The user sees a 502 Proxy Error in the browser that says:The proxy server received an invalid response from an upstream server. The proxy server could not handle the requestPOST. Reason: Error reading from remote server
Apache Server 2.2 error log displays errors similar to:proxy: Error reading from remote server returned by ...
Environment Apache HTTP Server 2.2 is configured as a proxy or reverseproxy in front of some other back-end web server.
Server version: Apache/2.2.6 (FreeBSD) with mod_proxy and Tomcat 5.5. Both apache and tomcat is on same system.
I tried with KeepAlive; KeepAliveTimeout <Limit>; However I looking for a solution which would not required any timeout <Limit>.
My httpd.conf looks like this:
LoadModule proxy_module libexec/apache22/mod_proxy.so
LoadModule proxy_http_module libexec/apache22/mod_proxy_http.so
#
# For mod_proxy.
#
ProxyRequests Off
ProxyPass /rs http://localhost:8080/A/R
ProxyPassReverse /rs http://localhost:8080/A/R
# To handle internal requests send by r wizard
ProxyPass /R http://localhost:8080/A/R
ProxyPassReverse /R http://localhost:8080/A/R
My server.xml setting are :
<Connector port="8080" address="127.0.0.1" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"
proxyName="localhost" proxyPort="80" emptySessionPath="true"/
>
Feb 08, 2010
Anonymous
Could it be that this is not working anymore since Confluence 3.1+ ?
I posted a comment here explaining my case, it should have been on this page instead :
http://confluence.atlassian.com/display/DOC/Adding+SSL+for+Secure+Logins+and+Page+Security?focusedCommentId=213516563#comment-213516563
Apr 06, 2010
Paul Southworth
I configured Confluence 3.2 behind an F5 LTM load balancer. I'm doing SSL termination on the F5, while Confluence serves plain HTTP. The instructions on this page were useful but the instructions in the section titled "Adding SSL" are incomplete.
In addition to "define the ProxyPass and ProxyPassReverse directives to pass through to Tomcat" you must also set the "scheme" in the Tomcat Connector configuration.
If your proxy's hostname is wiki.example.com you will need to add the following to the Connector settings in server.xml:
proxyName="wiki.example.com" proxyPort="443" scheme="https"
Jul 13, 2010
Jeff Lord
We are deploying jira/confluence behind and f5.
Setup looks like client https => F5 => apache proxy => tomcat
I have the apache proxy => tomcat working ok.
Going through the F5 is causing trouble. Any ideas or help would be greatly appreciated.
Sep 26, 2011
Anonymous
Thanks — This is what I overlooked
Jun 09, 2010
Anonymous
Followed all the instructions and advice above but still have a problem.
My setup is as follows:
CLIENT -- INTERNET-HTTPS-FIREWALL-APACHE REVERSE PROXY-HTTP--APPLICATOIN SERVER
The APPLICATION SERVERs are: Crowd, Jira and Confluence (Fisheye and Bamboo to be added when this setup is working properly).
I can log in perfectly, Crowd works like a charm.
The only issue is that I can't get a gadget from JIRA to work in Confluence and vice versa. As a URL it keeps using https://<external (https://<external)\_URL>. CHanging it to the internal URL allows me to add the gadget, but that's about it. They simply won't work.
Any idea which setting needs to be changed in order to get it working properly?
Thank you in advance,
Pascal
Jun 09, 2010
Edwin Dawson [Atlassian Technical Writer]
Hi there,
For help with integrating Atlassian products behind the firewall, take a look at our comprehensive integration guide. It provides complete instructions for setting up gadgets across the Atlassian suite.
I hope this helps.
Best Regards,
–
Edwin Dawson
Technical Writing Team Leader
edawson@atlassian.com
ATLASSIAN - http://www.atlassian.com
Jun 14, 2010
Anonymous
Hi Edwin,
I followed those instructions, but no result. Tried to set the Trusted Applications again, but requesting the URL threw an error. Tried for days to fix the problem, but ended up submitting a support ticket.
Will post result here when the issue is fixed, so it might help someone else.
Best regards,
Pascal
Mar 23, 2011
iain wright
Did you ever figure this out?
We are experiencing the same issue when attempting to integrate confluence as a trusted application in JIRA
Aug 12, 2010
Rune Stilling
I just want to share some experiences with trying to use mod_proxy. Couldn't make the ProxyHTMLURLMap directive work though since my confluence app is running as Tomcat Root. Anyways it worked fine except that links to attachments with URL's containing danish characters (æøå) didn't work but returned a "Page not found" error. So - Something went wrong between Apache and Tomcat. Don't know if this could have been fixed with ProxyHTMLURLMap but I decided to use mod_jk instead and that worked.
\Rune
Aug 13, 2010
David Leifer
I have a very basic problem - I have Jira, Confluence, and Crowd installed and all working. I'd like to change the URL so users don't have to enter the port #, however there is no httpd file on my machine. I'm running Windows server 2008 and installed the stand alone verions of each Atlassian program.
I got Jira to working without having to specify the port by editing the server.sml file only but I think I was only able to do that because it's using the default port - 8080, so can not do it the same way for the others.
Would really appreciate any help.
Thanks!
Aug 16, 2010
Azwandi Mohd Aris [Atlassian]
Hello David,
You will need to install and configure a proxy server e.g. Apache HTTPd server to get this setup as intended. It's free and there is a lot of resources on the net you can refer to.
Also, I believe JIRA is set to use default HTTP port 80, instead of 8080. Using this method is simple, yet limited to one application. If you have a proxy server, set it to use default port 80 and all other apps may use different port numbers such as 8080, 8081 and so on.
You may wish to refer to our Running Confluence behind Apache pertaining to the configuration. FYI, using mod_proxy is simpler than mod_jk.
Hope this helps.
Jan 08, 2011
Martin Reed
The setup I was trying to go for is to access confluence at the root of the external URL, and keep the Tomcat context at /confluence internally. I have a single instance of Tomcat fronted by Apache. Using the root at the external level was easy if I used the ROOT.xml context under Tomcat... however that was not preferred. The problem I was having when using the /confluence context was that CSS and links were screwed up when the page rendered. I finally got it working using a combination of ProxyPass and a RewriteRule. The ProxyHTMLURLMap was doing nothing for me until I added SetOutputFilter.
Jan 12, 2012
Anonymous
Just FYI, I have found a problem with using the simple mod_proxy setup with Confluence 4.0, Fedora 15 and mod_security. Everything works fine, except saving changes to a page. Those throw a 403 error. My only solution so far is to disable mod_security.
Jan 23, 2012
Jason Huntley
By setting up SSL on the Apache httpd server and proxy the requests over to local non-ssl tomcat, is the connection from the host to the client still encrypted? Does the proxy httpd server secure the connection?
Add Comment