?
avatar strawhatgami
strawhatgami
10 Mar 2020

Steps to reproduce the issue

0/ Since it is an error due to a timeout, the hard drive access time, reading and writing speeds may influence a lot the result.
1/ Run Docker image joomla:3.9 (https://github.com/joomla/docker-joomla)
2/ Put this image behind a basic apache HTTP proxy, using something like ProxyPass http:// and ProxyPassReverse http://, but without changing the default Timeout directive (default value is 60).
3/ execute the installation wizard
4/ at final step (after step 3, when the JS installer calls the tasks requests on the server), wait ~2minutes and the error should happens in logs. The developer tools indicates a failed request on /installation/index.php?task=InstallDatabase
5/ Sometimes, you could be redirected on installer first step view after a while

Instead of the previous steps, another - quicker but not tested - procedure should work:
1/ do a simple unzip of a joomla install that includes the .htaccess generated from /htaccess.txt
2/ call /error/ on your browser to see the recursive redirection.

Every path string that matches \/([^\/]+)\/.* except /installation/index.php is affected, and will redirect to /$1/installation/, then /$1/installation/installation/, then...

Expected result

Installer tells me "Installation finished!" after a while, and so I finished the installer execution and start using Joomla.

Actual result

I got stuck on installation final step (after step 3) with an unhelpful error message, then get redirected on first step.
My browser indicates a "too many redirections" error in development tools, and Docker logs give me (cleaned logs):

POST /installation/index.php?task=InstallDatabase_backup HTTP/1.1
GET /error/HTTP_BAD_GATEWAY.html.var HTTP/1.1
GET /installation/installation/index.php HTTP/1.1
GET /installation/installation/installation/index.php HTTP/1.1
...
GET /installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/installation/index.php HTTP/1.1

I finally found the main issue is because apache default request timeout is too short for the /installation/index.php?task=InstallDatabase 90+ seconds duration request.

Maybe the installer should print a note on it, since it is uncommon to have such long requests? Or maybe find another "proper" solution that don't use such long requests?

However my point here is that the .htaccess file does a too broad - and not well done - redirection: the apache-initiated /error/HTTP_BAD_GATEWAY.html.var request should not be redirected recursively endlessly.

The installer is hard to debug because of this.

System information (as much as possible)

# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   5638 MB in  2.00 seconds = 2822.11 MB/sec
 Timing buffered disk reads: 244 MB in  3.02 seconds =  80.83 MB/sec

Even if I use Docker, the error looks not linked to the docker declination of Joomla, but to Joomla itself.

Additional comments

  • I am new to Joomla. Please apologize if this subject has already been discussed (I see in SO that SEF has been an issue at the installation phase for other people), but I don't find an issue that corresponds to the issue I describe here, so I create this one.
  • I also don't separate my story in two distinct issues, since the redirection issue is hard to understand without linking it to an installer issue. Please tell me if you prefer a separate one for the installation request timeout.
  • I put the docker container behind a reverse proxy that "causes" the initial issue, and this first issue caused the current one.
  • If some people are searching a temp fix to the first issue on an apache install, just add something like Timeout: 180 to the proxy's virtualhost (the one containing the ProxyPass directive).
avatar strawhatgami strawhatgami - open - 10 Mar 2020
avatar joomla-cms-bot joomla-cms-bot - change - 10 Mar 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Mar 2020
avatar richard67
richard67 - comment - 10 Mar 2020

Instead of the previous steps, another - quicker but not tested - procedure should work:
1/ do a simple unzip of a joomla install that includes the .htaccess generated from /htaccess.txt
2/ call /error/ on your browser to see the recursive redirection.

I can't really reproduce that. I have a .htaccess mainly based on the one shipping with Joomla 3.9, and for me error pages still work.

@strawhatgami Can you reproduce your first test (i.e. not the one mentioned here, this is the second test) with using a normal Joomla installation and not the docker image?

avatar strawhatgami strawhatgami - change - 10 Mar 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-03-10 23:00:55
Closed_By strawhatgami
avatar strawhatgami
strawhatgami - comment - 10 Mar 2020

I downloaded the last joomla from https://downloads.joomla.org/fr/latest, and plug it on my host apache.

I reproduced the second test (the quick method) with those virtual hosts (thus without Docker):

<Virtualhost *:443>
  ServerName front.name

  # Let's Encrypt verification dir
  Alias /.well-known [hidden]

  ProxyPass /.well-known !
  ProxyPass / http://back.name/
  ProxyPassReverse / http://back.name/

  SSLEngine on
  SSLCertificateFile [hidden].pem
  SSLCertificateChainFile [hidden].pem
  SSLCertificateKeyFile [hidden].pem
  SSLCACertificateFile [hidden].pem
</VirtualHost>

<Virtualhost *:80>
  ServerName back.name

  DocumentRoot /path/to/joomla
  <Directory /path/to/joomla/>
      Options +FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>
</VirtualHost>

I also injected the .htaccess from my docker installation, and compared it with /htaccess.txt:

# diff .htaccess htaccess.txt 
31c31
< #Options -Indexes
---
> Options -Indexes
86d85
< 

The 2 files are nearly the same; at least we can say the redirection part is the same.

I confirm the issue does not exist (tested the quick method) when I delete the .htaccess. In such a case, I just have a standard 404.

Last but not least: with the aforementioned vhosts, I don't have the issue with the installer (the first method).
I have instead a pretty helpful message:

Gateway incorrecte!
Le serveur proxy a reçu une réponse incorrecte de la part d'un serveur supérieur.
...
Error (none)

Note for this last test: I kept the mysql container (I didn't install mysql on my host system) for the test.

Looks it's finally something to investigate at least partly on docker side.
I'll continue to investigate on my side, if I have relevant news I will post them here.

avatar strawhatgami strawhatgami - close - 10 Mar 2020
avatar richard67
richard67 - comment - 10 Mar 2020

@strawhatgami Ok, thanks for investigating. Feel free to reopen this issue or make a new one if it turns out to be a Joomla issue.

avatar strawhatgami
strawhatgami - comment - 11 Mar 2020

I have just remembered that I forgot to make this vhost using exactly the same directives as the docker proxy one.

So I deleted Timeout: xx and added ProxyPreserveHost On and RequestHeader set X-Forwarded-Proto "https".

Now all paths - including / and /installation/index.php - do the endless redirection.

My current vhost (with the changes):

<Virtualhost *:443>
  ServerName front.name

  # Let's Encrypt verification dir
  Alias /.well-known [hidden]

  ProxyPass /.well-known !
  ProxyPass / http://back.name:8000/
  ProxyPassReverse / http://back.name:8000/

  ProxyPreserveHost On
  RequestHeader set X-Forwarded-Proto "https"

  SSLEngine on
  SSLCertificateFile [hidden]/cert.pem
  SSLCertificateChainFile [hidden]/chain.pem
  SSLCertificateKeyFile [hidden]/privkey.pem
  SSLCACertificateFile [hidden]/fullchain.pem
</VirtualHost>

<Virtualhost *:8000>
  ServerName back.name

  DocumentRoot /path/to/joomla
  <Directory /path/to/joomla/>
      Options +FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>
</VirtualHost>

With that new virtual host and a little digging in Joomla's code, I found the file includes/framework.php calls header('Location: installation/index.php'), that causes (in conjunction with the .htaccess) the endless redirection.

Maybe this can be changed to Location: /installation/index.php (or a more complex system if Joomla supports to be mounted under paths)?

Add a Comment

Login with GitHub to post a comment