Some Ajax queries by Confluence fail after configuring Confluence to run behind Apache
Asked by Graham Hannington:

I'm using a sandbox installation of Confluence 4.2 running on Windows Server 2003 (our production installation is still running Confluence 3.x; we're about to switch over to 4.2).

I have followed the [Atlassian documentation](http://confluence.atlassian.com/display/DOC/Using+Apache+with+mod_proxy) to configure this sandbox Confluence installation to run behind Apache (the Apache HTTP server).

That is, rather than accessing Confluence via the following URL (Tomcat port):

<http://myserver:8090>

I use:

<http://myserver/wiki>

(I am using myserver as a placeholder for the actual server name.)

In the Tomcat server.xml file, I have set the path attribute of the \<Context\> element to the value "/wiki".

In the Apache HTTP server httpd.conf file, I have added the following directives:

```
# Custom configuration for Confluence and z/OSMFProxyRequests OffProxyPreserveHost OnSSLProxyEngine OnProxyPass /zosmf/ https://fts2:32208/zosmf/ProxyPassReverse /zosmf/ https://fts2:32208/zosmf/&lt;Proxy *&gt;    Order deny,allow    Allow from all&lt;/Proxy&gt; ProxyPass /wiki http://localhost:8090/wikiProxyPassReverse /wiki http://localhost:8090/wiki&lt;Location /confluence&gt;    Order allow,deny    Allow from all&lt;/Location&gt;
```

(in addition to uncommenting the required LoadModule lines at the top of the file)

On the Confluence Administration page, I have set the Base URL to:

<http://myserver/wiki>

Prior to setting the base URL, the Firefox Firebug plugin reported many failed Ajax GET requests by Confluence.

However, now that I've done that, which I think completes the configuration, Confluence seems to be working fine, but Firebug is still reporting just a few failed Ajax GET requests by Confluence.

For example, Firebug shows that a GET request by Confluence for the following URL:

<http://myserver/rest/autoconvert/latest/shortcutlinkconfigurations>

fails, unsurprisingly (note the absence of wiki/ between myserver/ and rest/) with a 404 Not Found error.

(When I say working fine, that's probably because I've not tried using the functionality specific to that failed shortcutlinkconfigurations GET.)

Firebug shows that many other GET requests by Confluence - with wiki/ in the URL - succeed. It's not the sea of red I got before updating the base URL on the Admin page.

Am I doing something wrong; have I missed some configuration step? Or are some parts of the Confluence code not honoring this style of base URL (that is, they don't expect the base URL to refer to a directory after the host and port), while others are?

Bug, or (my) user error?

(Note that I am deliberately using "wiki" for the path, as opposed to "confluence".)

P.S. The above question is a copy of a JIRA issue that I have just created. When I had finished creating the JIRA issue, JIRA asked me if I wanted to post the issue here (to Atlassian Answers). "Why not?" I thought, then I came here and saw that there were quite a few markup conversion issues (unconverted JIRA wiki markup), which I've fixed by manually editing (clearly, Atlassian have some work to do if they want to make the JIRA/Answers experience a little more seamless).


Answers:
author: David at David Simpson Apps
body: Are you sure you've set the Base URL correctly? Ensure that it's set to the same address and path as you're accessing it from using Apache.

If that's good, it might be nice to match the Tomcat context to be the same path used in Apache. You can do this by adapting the contextpath in confluence-install/conf/server.xml to /wiki.

comments: author: Graham Hannington
body: Hi David,

Thanks for the answer.

I don't know how to be any more sure than I already am that I've set the Base URL correctly. As I mentioned, prior to doing that, I got a whole lot more Ajax failures than the few I get now.

I'm not sure what you mean by this:
> adapting the contextpath in confluence-install/conf/server.xml to /wiki.

As I mentioned:
> In the Tomcat server.xml file, I have set the path attribute of the \<Context\> element to the value "/wiki".

Is "adapting the contextpath" something else?