Jump to content
  • 0

Forcing Https Results In Redirect Loop


Ribbons

Question

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.

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

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]
Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

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...