Apache Reverse Proxy Search Not Working
Asked by Tin Pham:

Hi, I followed the [Confluence Reverse Proxy instructions](https://confluence.atlassian.com/kb/proxying-atlassian-server-applications-with-apache-http-server-mod_proxy_http-806032611.html?_ga=2.107044098.1875025915.1564022731-799995078.1560824263) as I want to put Apache2 in front of Confluence. Confluence loads, however, Search is not working.

Using Chrome Debug I can see the following error,

```
GET http://www.breakitdown.ca/confluence/s/ca6b4214dc4957e5b90edfd999cd552a-CDN/en_US/8100/e6b42acaec191a9bce4ab234dae0b1b08af15496/e00352cb0013a1867dc5de3984f0fae4/_/download/contextbatch/js/confluence-search-ui-plugin-main,-_super/batch.js?locale=en-US net::ERR_ABORTED 500
```

I am fairly certain that this has to do with my proxy settings for **synchrony.**

Perhaps there is a bug in the Atlasssian instructions? Has anybody got this working?

++And here is my setup....++

**Base Setup,**

Fresh install and imported backup of my website. I hit confluence on the default port and confirmed everything worked as expected,

[http://www.breakitdown.ca:8090](http://www.breakitdown.ca:8090/)

**Modified server.xml,**

Proxy listener,

```
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"                   maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="http" proxyName="www.breakitdown.ca" proxyPort="80"/>
```

Context root,

```
<Engine name="Standalone" defaultHost="localhost" debug="0">
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4">
<Context path="/confluence" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
<!-- Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->
<Manager pathname=""/>
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/>
</Context>
<Context path="${confluence.context.path}/synchrony-proxy" docBase="../synchrony-proxy" debug="0"
reloadable="false" useHttpOnly="true">
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/>
</Context>
</Host>
</Engine>
```

**Setup Apache,**

```
<VirtualHost *:80>

        ServerAdmin webmaster@localhost

        ServerName www.breakitdown.ca
        ServerAlias breakitdown.ca


        # Enforce www in front of url.
        RewriteEngine On
        RewriteCond %{HTTP_HOST} !^www\.breakitdown\.ca$ [NC]
        RewriteRule (.*) http://www.breakitdown.ca$1 [R,L]

        DocumentRoot /opt/www.breakitdown.ca/www

        <Directory /opt/www.breakitdown.ca/www/>
                Options Indexes FollowSymLinks
                AllowOverride None
                Require all granted
                DirectorySlash Off
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/www.breakitdown.ca.error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug

        CustomLog ${APACHE_LOG_DIR}/www.breakitdown.ca.access.log combined

        # Put this in the main section of your configuration (or virtual host, if using Apache virtual hosts)
        ProxyRequests Off
        ProxyPreserveHost On
        <Proxy *>
                Require all granted
        </Proxy>

        ProxyPass /synchrony http://localhost:8091/synchrony
        <Location /synchrony>
                Require all granted
                RewriteEngine on
                RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
                RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
                RewriteRule .* ws://localhost:8091%{REQUEST_URI} [P]
        </Location>

        ProxyPass /confluence http://localhost:8090/confluence
        ProxyPassReverse /confluence httpt://localhost:8090/confluence
        <Location /confluence>
                Require all granted
        </Location>

</VirtualHost>
```

Restarted everything and hit the site with the new context root,

<http://www.breakitdown.ca/confluence>

Was able to log in and got the warning that my context root was not right, so went into the Admin Console and changed **Server Base URL**,

<http://www.breakitdown.ca/confluence>

**System Details,**

Confluence 6.15.7  
Java 1.8.0_221  
Apache/2.4.29 (Ubuntu)


Answers:
author: Tin Pham
body: I've found the root issue and it's due to using 32-bit Java instead of 64-bit.

The tell was during startup of catalina.out "`synchrony version` `2.1``.``0``-release-confluence_6.``15``-`" line was missing,

```
2019-08-04 21:50:06,648 INFO [Catalina-utility-1] [com.atlassian.confluence.lifecycle] contextInitialized Starting Confluence 6.15.7 [build 8100 based on commit hash e6b42acaec191a9bce4ab234dae0b1b08af15496] - synchrony version 2.1.0-release-confluence_6.15-32f7299a
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
```

As for the proxy configuration, I think something is still off. What works for me is slightly different as I noticed some errors in my browser debug mode and my configs get rid of it.

This is a side issue so you can read more about it on my direct site which is being continuously updated as I write new Confluence setup instructions,

<http://www.bonsaiframework.com/wiki/display/bonsai/8.0+Confluence+6.x+Setup>


author: Tin Pham
body: Ok after reviewing the [posts](https://community.atlassian.com/t5/Confluence-questions/Apache-Config-for-Confluence-6/qaq-p/144625) from [@Scott Selberg](/t5/user/viewprofilepage/user-id/853450) and [@Neil Schulz](/t5/user/viewprofilepage/user-id/721059) I was able to make the basics of Apache2 proxy work where I don't use a context root - where [www.breakitdown.ca](http://www.breakitdown.ca) takes me directly to Confluence.

But I want to front more than one website and have Confluence living in a context root, [www.breakitdown.ca/](http://www.breakitdown.ca/)**confluence**

Here is the variant config that works so far... help to understand how to adjust would be appreciated.

```
<VirtualHost *:80>

        ServerAdmin webmaster@localhost

        ServerName www.breakitdown.ca
        ServerAlias breakitdown.ca

        RewriteEngine On
        ErrorLog ${APACHE_LOG_DIR}/www.breakitdown.ca.error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug
        CustomLog ${APACHE_LOG_DIR}/www.breakitdown.ca.access.log combined

        # Put this in the main section of your configuration (or virtual host, if using Apache virtual hosts)

        ProxyRequests Off
        ProxyPreserveHost On

        <Proxy *>
                Require all granted
        </Proxy>

        ProxyPass / http://localhost:8090/
        ProxyPassReverse / http://localhost:8090/

</VirtualHost>
```

Then same as first post, but change **server.xml** path to, "",

```
<Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
```

And finally log in admin and go to the web console and adjust the path to,

**Server Base URL**,

<http://www.breakitdown.ca>


Tags: atlassian-support

reverse-proxy