0

Even though I found some similar reports on SO no suggestion solved my issue. So I decided to raise a question myself.

I am running Confluence (and Jira) as WARs on a Tomcat instance on Ubuntu. The application is accessible via http://localhost:8080/confluence. I would like to configure apache as a proxy to allow public access via http://confluence.<servername>.de. Following the instructions on https://confluence.atlassian.com/display/DOC/Using+Apache+with+mod_proxy#UsingApachewithmod_proxy-complex I did the following steps:

  • appended the attributes proxyName="confluence.<servername>.de" and proxyPort="80" to the Connector element in /var/lib/tomcat7/conf/server.xml.
  • Defined a virtual host in /etc/apache2/sites-enabled/confluence.conf

The confluence.conf has the following content:

<VirtualHost *:80>
  ServerName confluence.<servername>.de

  ProxyRequests Off
  ProxyPreserveHost On

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

  ProxyPass / http://localhost:8080/confluence
  ProxyPassReverse / http://localhost:8080/confluence

  ProxyHTMLURLMap / /confluence/

  <Location />
    Order allow,deny
    Allow from all
  </Location>
</VirtualHost>

With this configuration I cannot invoke http://localhost:8080/confluence due to this (wget) output:

--2014-12-23 08:38:13--  http://localhost:8080/confluence
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8080... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://confluence.<servername>.de/confluence/ [following]
--2014-12-23 08:38:13--  http://confluence.<servername>.de/confluence/
Resolving confluence.<servername>.de (confluence.<servername>.de)... 92.51.163.197
Connecting to confluence.<servername>.de (confluence.<servername>.de)|92.51.163.197|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2014-12-23 08:38:13 ERROR 404: Not Found.

If I remove the attributes proxyName and proxyPort this access is possible. However, the invocation via http://confluence.<servername>.de still yields errors. The output of Apache log suggests that the URL rewrite is corrupt:

[Tue Dec 23 08:50:47.952647 2014] [authz_core:debug] [pid 24715:tid 140609413170944] mod_authz_core.c(828): [client 37.201.226.149:11808] AH01628: authorization result: granted (no directives)
[Tue Dec 23 08:50:47.952809 2014] [proxy:debug] [pid 24715:tid 140609413170944] mod_proxy.c(1104): [client 37.201.226.149:11808] AH01143: Running scheme http handler (attempt 0)
[Tue Dec 23 08:50:47.952838 2014] [proxy:debug] [pid 24715:tid 140609413170944] proxy_util.c(2020): AH00942: HTTP: has acquired connection for (localhost)
[Tue Dec 23 08:50:47.952851 2014] [proxy:debug] [pid 24715:tid 140609413170944] proxy_util.c(2072): [client 37.201.226.149:11808] AH00944: connecting http://localhost:8080/confluence to localhost:8080
[Tue Dec 23 08:50:47.953069 2014] [proxy:debug] [pid 24715:tid 140609413170944] proxy_util.c(2206): [client 37.201.226.149:11808] AH00947: connected /confluence to localhost:8080
[Tue Dec 23 08:50:47.953176 2014] [proxy:debug] [pid 24715:tid 140609413170944] proxy_util.c(2483): (111)Connection refused: AH00957: HTTP: attempt to connect to [::1]:8080 (localhost) failed
[Tue Dec 23 08:50:47.953277 2014] [proxy:debug] [pid 24715:tid 140609413170944] proxy_util.c(2610): AH00962: HTTP: connection complete to [::1]:8080 (localhost)
[Tue Dec 23 08:50:47.956860 2014] [proxy:debug] [pid 24715:tid 140609413170944] proxy_util.c(2035): AH00943: http: has released connection for (localhost)
[Tue Dec 23 08:50:47.988123 2014] [authz_core:debug] [pid 24715:tid 140609402681088] mod_authz_core.c(828): [client 37.201.226.149:11808] AH01628: authorization result: granted (no directives)
[Tue Dec 23 08:50:47.988231 2014] [proxy:debug] [pid 24715:tid 140609402681088] mod_proxy.c(1104): [client 37.201.226.149:11808] AH01143: Running scheme http handler (attempt 0)
[Tue Dec 23 08:50:47.988250 2014] [proxy:debug] [pid 24715:tid 140609402681088] proxy_util.c(2020): AH00942: HTTP: has acquired connection for (localhost)
[Tue Dec 23 08:50:47.988264 2014] [proxy:debug] [pid 24715:tid 140609402681088] proxy_util.c(2072): [client 37.201.226.149:11808] AH00944: connecting http://localhost:8080/confluenceconfluence/ to localhost:8080
[Tue Dec 23 08:50:47.988277 2014] [proxy:debug] [pid 24715:tid 140609402681088] proxy_util.c(2206): [client 37.201.226.149:11808] AH00947: connected /confluenceconfluence/ to localhost:8080
[Tue Dec 23 08:50:47.990134 2014] [proxy:debug] [pid 24715:tid 140609402681088] proxy_util.c(2035): AH00943: http: has released connection for (localhost)

Am I missing anything? By the way, if I adjust the virtual host configuration in a way that the URL http://<servername>.de/confluence is used as a proxy everything works fine.

Any suggestion would be greatly appreciated.

  • Try change `ProxyHTMLURLMap / /confluence/` to `ProxyHTMLURLMap /confluence/ /` – Federico Sierra Dec 23 '14 at 15:50
  • Thanks for the suggestion. However, this leads to the same result and even the same apache log output. In turn, I suppose this directive is not even considered. The result remains even if I enter nonsense. – Andreas Hahne Dec 23 '14 at 18:58
  • Check this http://stackoverflow.com/questions/14431090/proxyhtml-to-rewrite-url, maybe can be help add `SetOutputFilter proxy-html`. – Federico Sierra Dec 23 '14 at 19:16
  • Unfortunatelly, no success, either. Also the directive `ProxyHTMLEnable On` had no effect. – Andreas Hahne Dec 23 '14 at 19:38
  • Do you get a ping response from `confluence..de` from correct IP? Try this one in Virtual Host `ServerName .de ServerAlias confluence..de ` – slash Dec 23 '14 at 19:58
  • i will flip a question a bit. is there a reason you'd want to deploy 2 WARs and not use Confluence standalone and JIRA standalone? - just configure them to run on different ports. this config is proved to be working - I ran it for a few years this way – webwesen Dec 23 '14 at 22:35
  • Valid question. I wanted to avoid two tomcat instances running at a time with regard to system resources. But as configuration is much easier this seems to be the appropriate way. – Andreas Hahne Dec 24 '14 at 10:30

1 Answers1

0

My personal preference is to deploy applications in subfolders and set up proxy like:

ProxyPass "/confluence/" "http://localhost:8080/confluence/"
ProxyPassReverse "/confluence/" "http://localhost:8080/confluence/"

No need for ProxyHTMLURLMap, that's probably why you see "AH00944: connecting http://localhost:8080/confluenceconfluence/ to localhost:8080"

Setting up like you intended might be a little tricky, since you need the fully qualified domain name of your machine to be confluence.servername.de and you need an A record in your local DNS for this as well. I second Slash's question: can you ping confluence.servername.de?

When this is taken care of, you may also want to look into using these directives, as needed:

ProxyRequests Off
ProxyVia Off
RemoteIPHeader X-Forwarded-For
RequestHeader    unset  Accept-Encoding
ProxyHTMLEnable On
ProxyHTMLExtended On
<Proxy *>
    Require all granted
</Proxy>