How to use reverse proxy with apache for kobotoolbox

Hi,

In my kobotoolbox installation I need to use a custom certificate. I opted for the option of doing a reverse proxy, which by default, the application listens to port 8080, so I am using apache to place an SSL certificate.

For each of the 3 kobo subdomains (kpi, kobocat and enketo), I have a virtual host in Apache, as follows:

VirtualHost *:80
ServerName subdomain.domain.cl
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
VirtualHost

IfModule mod_ssl.c
VirtualHost *:443
ServerName subdomain.domain.cl
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
SSLEngine on
SSLCertificateFile …/certfile.crt
SSLCertificateKeyFile …/keyfile.key
SSLCertificateChainFile …/intermediate_certificate.cer
VirtualHost
IfModule

Having the same structure for each subdomain

Having the same structure for each subdomain. My problem arises that when trying to access the application, the domains (Any of the 3), ends up returning 301 Moved Permanently, and ends up redirecting itself infinitely.

Reviewing the request data, it is the same kobo nginx that performs the redirection, so I intuit that the reverse proxy is sending the request to port 8080. What I think happens is that there is a conflict between the redirection of the Nginx and my virtual host.

Any idea what it could be ?, I’ve been killing myself with this for days

Hi @jvega
Could you add this header in apache configuration
RequestHeader set X-Forwarded-Proto https and check whether this works for you?

You could also follow the discussions here

Regards
Stephane

2 Likes