0

I'm using heroku, apache, php and gnusocial. My plan is to deploy a GNU Social instance for my family.

I fiddled with the composer.json file, to where it looks like this:

{
    "name": "jmm/me-and-mine",
    "description": "GNU social is a free social networking platform.",
    "require": {
        "openid/php-openid": "^2.3",
        "ext-gd": "*",
        "ext-curl": "*",
        "ext-intl": "*",
        "ext-json": "*",
        "ext-mysqlnd": "*",
        "ext-mbstring": "*"
    },
    "include-path": [
        "extlib/"
    ]
}

where before there was none, although there appears to have been a merge request for a composer.json file once.

Anyway, I allocated a database, and a sendmail grid, and went through the installation steps for gnu social. Most of that is familiar from setting up Drupal, but here I get a strange error I've never seen before:

This page isn’t working leudla.herokuapp.com redirected you too many times. [...] ERR_TOO_MANY_REDIRECTS

I've tried setting up the page with and without ssl, but preferably, I'd like to set it up with ssl, since I hope to have other people over. Anyone know how I can fix this?

You can get a closer look at the setup here: https://leudla.herokuapp.com

For completeness, I'll also include the .htaccess file. Everything else is stock GNU Social. ** Update ** In the meantime, I've reset the htaccess file that ships with the program, and uncommented the comment that says: "if you have problems". Here it is:

### GNU social "fancy URL" setup
#
#   Change the "RewriteBase" in the new .htaccess file to be the URL path
#       to your GNU Social installation on your server. Typically this will
#       be the path to your GNU Social directory relative to your Web root.
#       If you are installing it in the root directory, leave it as '/'.
#
#   If it doesn't work, double-check that AllowOverride for the GNU Social
#       directory is 'All' in your Apache configuration file. This can be
#       * /etc/apache2/apache2.conf (generic)
#       * /etc/apache2/sites-available/default(on Debian and Ubuntu)
#       * ...many other variations depending on distribution...
#
#   See the Apache documentation for .htaccess files for more details:
#       https://httpd.apache.org/docs/2.4/howto/htaccess.html
#
#   Also, check that mod_rewrite is installed and enabled:
#       https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html


<IfModule mod_rewrite.c>
  RewriteEngine On

  # NOTE: change this to your actual GNU social base URL path,
  # minus the domain part:
  #
  #   https://social.example.com/        => /
  #   https://example.com/social/ => /social/
  #
  RewriteBase /
  #RewriteBase /mublog/

  ## Uncomment these if having trouble with API authentication
  ## when PHP is running in CGI or FastCGI mode.
  #
  RewriteCond %{HTTP:Authorization} ^(.*)
  RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule (.*) index.php?p=$1 [L,QSA]

  ## You can also use PATHINFO by using this RewriteRule instead:
  # RewriteRule (.*) index.php/$1 [L,QSA]
</IfModule>

<FilesMatch "\.(ini)">
    <IfVersion < 2.3>
        Order allow,deny
        Deny from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all denied
    </IfVersion>
</FilesMatch>

At MichaelHampton's suggestion, I cleared the browser cache, but still no luck.

** Update: ** I removed a couple of dependencies from composer.json, and got a fresh copy of the gnu social source.

This might seem obvious, but this error only occurs when I enable Server SSL. I wonder if there's additional configuration I need to do.

** Update: ** I renamed the site to leudla.herokuapp.com

  • I assume you already know but the "ERR_TOO_MANY_REDIRECTS" error means that you're probably in a redirection loop. Something is causing you to get redirected over and over again. I see that you have a snippet in your .htaccess that says "Redirect to https version". My guess (without knowing these techs too well) is that there's something wrong with that line causing it to redirect to itself which in turn causes another redirect, and another, and another... – duct_tape_coder Dec 19 '18 at 19:48
  • Hmm, I did not know that. This error only occurs when I enable ssl on the gnu social installation. It works fine when I leave that option disabled, but I'd rather not serve up unencrypted content for my family's christmas. – Joshua M. Moore Dec 19 '18 at 21:07
  • Most likely then, enabling SSL prevents the HTTP access and causes you to immediately hit HTTPS and trigger the redirect... back to the HTTPS with the redirect. Try leaving the SSL enabled and turn the redirect off. You could disable port 80 access to prevent HTTP access entirely or you could set up a different website for the HTTP to redirect to the HTTPS site. Long story short, I think you're just doing the HTTP->HTTPS redirect incorrectly. – duct_tape_coder Dec 19 '18 at 21:20
  • Hmm, I just tried that. I took out all the rewrite rules from the .htaccess, and reinstalled the server with ssl enabled. However, I get stuck in the redirect loop again. – Joshua M. Moore Dec 19 '18 at 21:40
  • I found a discussion on github about this very topic... https://github.com/heroku/heroku-buildpack-php/issues/47 I tried using their .htaccess file but still no luck. – Joshua M. Moore Dec 19 '18 at 21:53
  • Have you tried vanilla everything? If you use completely out of the box stuff and it still doesn't work, the issue may be external to your software. Something like a network firewall, packet forwarding, NAT translation, DNS or other issues may be occuring. – duct_tape_coder Dec 19 '18 at 22:47
  • It's vanilla, fresh out of the box. The only thing I added was the composer.json file for heroku to accept the application as a php application. Non SSL works, SSL redirects. I've filed a ticket with heroku.... But thanks for explaining redirect loops for me. I just wish I knew apache well enough to experiment with the htaccess file. – Joshua M. Moore Dec 19 '18 at 22:49

0 Answers0