Too many redirect when using docker compose and apache proxy reverse

Hi !

I’ve followed Install with Docker compose // Baserow to install Baserow on a DO droplet with enough resources :slight_smile:

The install is fine, at least I didn’t had anye noticeable errors.

To run baserow, I tried to use :
BASEROW_PUBLIC_URL=https://my.url.fr WEB_FRONTEND_SSL_PORT=4343 WEB_FRONTEND_PORT=8080 docker compose up -d

I use apache reverse proxy with this kind of config (that’s working with another docker running on 8000) :

<VirtualHost *:80>
	ServerName my.url.fr

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Proxy *>
            Require all granted
        </Proxy>

        ProxyRequests           Off
        ProxyPreserveHost       On
        ProxyPass               /       http://localhost:8080/
        ProxyPassReverse        /       http://localhost:8080/

        RewriteEngine on
        RewriteCond %{SERVER_NAME} =my.url.fr
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

And for the SSL part :

<VirtualHost *:443>
	ServerName my.url.fr

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	<Proxy *>
            Require all granted
        </Proxy>

        ProxyRequests           Off
        ProxyPreserveHost       On
        ProxyPass               /       http://localhost:4343/
        ProxyPassReverse        /       http://localhost:4343/

        RewriteEngine on
        RewriteCond %{SERVER_NAME} =my.url.fr
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

        SSLCertificateFile /etc/letsencrypt/live/my.url.fr/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/my.url.fr/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

The problem, I have a Too Many Redirects when I try to access the URL.

Do you have any idea ?

Thanks a lot

Additional info :

I’ve installed Baserow using the GIT version.
I’ve not modified the docker-compose.yaml, as I try to pass the variables before the docker compose command.

Hi @Mathieub, to be honest, this doesn’t seem like a Baserow problem, but rather an Apache config problem.

I’m not an expert in Apache, but in your SSL configuration you seem to have a RewriteCond that checks if the servername is equal to my.url.fr, and if that’s the case, redirect to RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI}. Because the servername is my.url.fr, it will always cause a redirect. This is most likely causing an Too Many Redirects error. I would remove the RewriteCond and RewriteRule in the SSL part, and try again.

Expert or not, I’ve tried your advice (much appreciated).

I have now another error. This one is a 502 :

# Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request

Reason: **Error reading from remote server**

I’m gonna keep lookiong for a fix, but if you have an idea, that’s perfect !
Thanks for your help !

Hi @Mathieub, just wanted to check in if you found a solution to this problem yet or not?

Not for the moment sadly.

I wish I new better how to setup many dockers on the same server accessible from the outside :slight_smile:
But my sysadmin skills are limited :confused: