Configuring Apache Reverse Proxy Using the AJP Protocol
Atlassian applications allow the use of reverse-proxies within our products, however Atlassian Support does not provide assistance for configuring them. Consequently, Atlassian can not guarantee providing any support for them.
If assistance with configuration is required, please raise a question on Atlassian Community.
“Ghostcat” vulnerability in Apache Tomcat
Following this guide might make your Jira instance prone to a recent high-risk vulnerability found in Apache Tomcat.
Step 1: Configure Tomcat
- Stop Jira.
Enable the AJP Connector on the Tomcat container hosting Jira by uncommenting the following element in
$JIRA_INSTALL/conf/server.xml
:<Connector port="8009" URIEncoding="UTF-8" enableLookups="false" protocol="AJP/1.3" />
- Start Jira.
- Test that Jira is accessible on the standard HTTP connector, for example
http://jiraserver:8080
. This is to ensure that Tomcat has successfully restarted.
Step 2: Configure Apache HTTP Server
The installation of Apache and configuration of a DNS is not covered in this documentation. Additionally, it is assumed that Apache 2.2 has been installed and DNS entries have been configured for the Jira domain. As Apache's configuration is specific to the operation system that is used, only some distributions and their configurations are currently documented.
2.1 Enable the Proxy Modules
Debian/Ubuntu
Windows/Other OS
2.2. Configure Apache to use those Modules
Debian/Ubuntu
Windows/Other OS
2.3 Redirect HTTP to HTTPS
This is an optional step and is only required if using HTTPS. It can be done by using mod_rewrite (this module may require enabling), add the following to the HTTP VirtualHost
:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Step 3: Configure Jira
- Set Use gzip compression to OFF as in Configuring Jira options. GZIP compression is known to cause performance issues using a reverse-proxy, especially if the proxy is also compressing the traffic.
- Set the Base URL to be the FQDN that Jira will be accessed on, for example http://jira.atlassian.com. This is also located in Configuring Jira options.
Jira can only be configured to respond to a single URL and the Base URL (as in Configuring Jira options) must match the URL end-users are accessing. Misconfiguration of this may cause significant problems within Jira such as the Activity Stream and Dashboard Gadgets failing to function correctly. - Test by accessing Jira on the FQDN (e.g.: http://jira.atlassian.com), ensuring that Jira is accessible and all dashboard gadgets correctly display.
Troubleshooting
- Hijacked Sessions: Some users have reported problems with user sessions being hijacked when the mod_cache module is enabled. If these problems are encountered, try disabling the
mod_cache
module.
This module is enabled by default in some Apache HTTP Server version 2 distributions. - Permission Denied Errors enabling
mod_proxy
(andmod_jk
) on Linux distros that use SELinux: Users have reported 'permission denied' errors when trying to getmod_proxy
(andmod_jk
) working. Disabling SELinux (/etc/selinux/config
) apparently fixes this. Running Mac OS X: Disable webperfcache, which proxies port 80 by default. A user reported this as the likely cause of Jira session problems, in the form of users' identities becoming mixed up, as below.
Additionally we do not recommend using Max OS X as it is not supported, as in our Supported platforms.
The OSX Servers enable webperfcache by default for Virtual Hosts, which for static content would be great, but for dynamic instances (which ALL of ours are) it is Evil and causes many issues.
Of note recently was the jira session issue. Also see :-
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/webperfcache.8.html
Unfortunately even if you disable webperfcache for a instance, if there is a single instance enabled then all instances will still proxy through webperfcache with resulting session problems.
- Too many redirects: Both Tomcat & Apache are redirecting, when only one should be. Disable redirection in Tomcat (revert any changes as in Running Jira over SSL or HTTPS) and check that there is only one redirection in Apache.
- General Problems:
- Clear the browser cache and try again.
- Ensure that Jira works as expected when running directly from Tomcat and bypassing Apache. For example, accessing
http://jiraserver:8080
instead of http://jira.atlassian.com. - Increase the LogLevel for Apache to debug and restart it.
- Attempt to access Jira and check the Apache Log Files for any errors.
- Raise a question on Atlassian Answers for assistance.
- 403 Forbidden error:
Add the
RequestHeader unset Authorization
line to the apache configuration page to disable authorization headers.<Location /jira> RequestHeader unset Authorization ProxyPreserveHost On ProxyPass http://jiraserver/jira ProxyPassReverse http://jiraserver/jira </Location>