Jump to content
  • 0

Forcing Https Results In Redirect Loop


Question

Posted

Hello, back again for some assistance.

 

I've opened up the .htaccess and uncommented the two lines to enforce https on Blesta.

 

It results in a redirect loop.

 

I contacted my provider, wondering if it was something on their end and not Blesta first. They were kind enough to poke at the .htaccess file for me but no such luck.

 

Any opinions or help would be appreciated, thanks.

11 answers to this question

Recommended Posts

  • 0
Posted

Adding LogLevel rewrite:trace6 (Apache 2.4) or RewriteLogLevel 4 (Apache 2.3) might help you to find the problem. I think both should work in the .htaccess file (RewriteLogLevel only works in .htaccess on Apache > 2.3.6)

  • 0
Posted

An update:

 

My hosting provider and I were able to enforce https but at the cost of breaking all the portal / login links. 

 

I've reverted back to the original unmodified .htaccess. Any further assistance would be appreciated.

  • 0
Posted

Do you have any results from the logs based on my above post? What did you do to get it working on some pages and what error did you receive on the portal/login pages? I really need a bit more info to help.

  • 0
Posted

I think I fixed it by accident to be honest.

 

I seemed to have fixed it with the following:

########################################################
# package:    minPHP
# filename:   .htaccess
########################################################

<Files ~ "\.(pdt)$">
   order deny,allow
   deny from all
</Files>

# Protect against Clickjacking
Header append X-Frame-Options "SAMEORIGIN"

RewriteEngine on

# Force HTTPS
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://my.hostmyheart.com/$1 [R,L]
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=307,NE,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php

RewriteCond %{REQUEST_URI} ^(.*)/install.php$
RewriteRule install.php %1/install/ [R=301,L]
  • 0
Posted

That's great. Why don't you start changing each part back to more closely match the original, so you can find what the problem was? You could start by

 

1. Adding the NE flag

2. Removing RewriteCond %{SERVER_PORT} 80

3. Changing the redirect to a 307, ultimately it should probably be a 301 because those are cached.

4. Changing my.hostmyheart.com/$1 to %{HTTP_HOST}%{REQUEST_URI}

5. Changing ^(.*)$ to ^ or .*

 

This could help if anybody else has the same problem.

  • 0
Posted

I'm going to try your suggestions and update with what breaks / helps.

 

Hello, I've made all the changes you suggested with success except the following:

 

Removing RewriteCond %{SERVER_PORT} 80 broke the site. All changes have been made to match the original except keeping that condition in place.

  • 0
Posted

Not sure why it would need that, I would have thought RewriteCond %{HTTPS} !=on was enough. Someone else can probably tell you why that is. Does it work with RewriteCond %{HTTPS} off ?

  • 0
Posted

Any word from blesta developers on this issue?

 

I have done a clean install of blesta on a Debian VPS. After configuring SSL stuff and installing recommended apache mods for best page load times, Blesta included mod_rewrite rules to force HTTPS will catch Google Chrome in redirection loop, while Safari it's still working.

 

Mods Installed.

-mod_spdy (maybe google chrome it's using SPDY while safari isn't)

-PHP FPM

-FastCGI

 

Solution: 

Add

RewriteCond %{SERVER_PORT} 80
before
RewriteCond %{HTTPS} !=on

 

 

Rodrigo

P.S: found this thread by searching in google for this issue

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...