SSL & invain redirection to domain with :80 added

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
steve59
Registered User
Posts: 53
Joined: Mon Jun 01, 2015 9:32 am

SSL & invain redirection to domain with :80 added

Post by steve59 » Mon Dec 04, 2017 4:37 pm

Dear reader,

Our web hosting provider serves SSL via port 80.

Now when someone posts on our forum (version 3.2.1), they first get the message that their post needs approval,
which is correct (read we wanted that)
Next, after approx. 10 seconds, an automatic redirection follows

The problem is, that this redirection address containts :80 in de web address
after the domein name. This causes endless waiting, followed by an error

When I copy the link and remove :80 from it, the address is ok

This question I asked before about problems when entering the ACP might be related:
viewtopic.php?f=556&t=2448856

Best regards
Steve

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2797
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: SSL & invain redirection to domain with :80 added

Post by thecoalman » Mon Dec 04, 2017 4:47 pm

Do you have "Force server URL settings:" set to yes?

steve59
Registered User
Posts: 53
Joined: Mon Jun 01, 2015 9:32 am

Re: SSL & invain redirection to domain with :80 added

Post by steve59 » Mon Dec 04, 2017 5:11 pm

Do you have "Force server URL settings:" set to yes?
Hello thecoalman,
I changed this to "yes".

Now the redirect seems to be to the correct URL first
(with the message establishing SSL connection)
and then :80 is added again and connection fails

Copying and pasting the URL without :80 then gives the correct
forumpage

steve59
Registered User
Posts: 53
Joined: Mon Jun 01, 2015 9:32 am

Re: SSL & invain redirection to domain with :80 added

Post by steve59 » Mon Dec 04, 2017 7:28 pm

I found a "solution":

When I force the server port in phpbb (via the ACP panel) to 443,
then the problem goes away

Also this related issue seems to be "solved" then:
viewtopic.php?f=556&t=2448856

However, 443 is not the correct port, our provider uses port 80
for https (SSL)!

So before we apply this, we would like to know why (and how) this works
(since we don't want to create bigger problems elsewhere in phpbb or on other parts of our site - like redirect loops)

Steve

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 49557
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: SSL & invain redirection to domain with :80 added

Post by stevemaury » Mon Dec 04, 2017 7:41 pm

I would ask the host.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. PM or email me.

All unsolicited PMs will be ignored.

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2797
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: SSL & invain redirection to domain with :80 added

Post by thecoalman » Mon Dec 04, 2017 10:52 pm

steve59 wrote:
Mon Dec 04, 2017 5:11 pm
Do you have "Force server URL settings:" set to yes?
Hello thecoalman,
I changed this to "yes".
I guess I should of been a little clearer, if it was already set to yes it could cause the port to be appended with the port.

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2797
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: SSL & invain redirection to domain with :80 added

Post by thecoalman » Mon Dec 04, 2017 10:54 pm

steve59 wrote:
Mon Dec 04, 2017 7:28 pm
However, 443 is not the correct port, our provider uses port 80
for https (SSL)!
443 is common port for SSL....

steve59
Registered User
Posts: 53
Joined: Mon Jun 01, 2015 9:32 am

Re: SSL & invain redirection to domain with :80 added

Post by steve59 » Tue Dec 05, 2017 8:17 am

We came a bit further!

First we resetted (in ACP) "Force server URL settings" to "no" (to make phpbb able to choose the server port by itself),
and we resetted (in ACP) the server port setting to 80 (which is in our case the correct port although we use https protocol /SSL)

Next we found out that our problem is generated bij this code in function generate_board_url (in include/functions.php)

------------
if ($server_port && (($cookie_secure && $server_port <> 443) || (!$cookie_secure && $server_port <> 80)))
{
// HTTP HOST can carry a port number (we fetch $user->host, but for old versions this may be true)
if (strpos($server_name, ':') === false)
{
$url .= ':' . $server_port;
}
}
------------

Next, we disabled this piece of code

This seems to solve our problem.

However, is this a correct solution? Or can it create problems we are not aware of?
Steve

User avatar
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 24717
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: SSL & invain redirection to domain with :80 added

Post by Paul » Tue Dec 05, 2017 12:11 pm

The correct solution is to tell your host to follow standard and use 443 for SSL traffic.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

steve59
Registered User
Posts: 53
Joined: Mon Jun 01, 2015 9:32 am

Re: SSL & invain redirection to domain with :80 added

Post by steve59 » Thu Dec 07, 2017 12:47 pm

We contacted our host. In contrast of what they said earlier, they use port 443 for our https-pages.
However, they serve those pages indirectly. This was the reason that we seemed to detect 80 as port.

We solved this problem bij setting the port to 443 in the phpbb-software,
and we set "force server URL settings" to "yes".
Until now this solution works, without having to change anything in the phpbb-code
(so we're back to standard code now)

User avatar
mamba
Registered User
Posts: 426
Joined: Thu Jan 16, 2003 7:59 pm

Re: SSL & invain redirection to domain with :80 added

Post by mamba » Sat Jul 07, 2018 10:01 pm

I was having this problem too when port was left at 80 in "force server settings" and I was forcing HTTPS in my .htaccess file in the forum subfolder.

I changed it to 443 and it seems to work.

But I found that I could simply uncheck "force server settings" and just use this code in my forum's .htaccess file:

Code: Select all

# force https (added by me)
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
This seems a better solution than sending emails etc with "example.com/forum:443" type urls
Using 3.2, PHP version 7, MySQL 5.5, Host: hostgator shared Linux, Style: Prosilver

User avatar
mamba
Registered User
Posts: 426
Joined: Thu Jan 16, 2003 7:59 pm

Re: SSL & invain redirection to domain with :80 added

Post by mamba » Sat Jul 07, 2018 10:22 pm

Whoa!

When I tested this setup (Force Server Setting OFF, .htaccess forcing SSL), no emails are sent by the board

I put Force Server Settings back to https and 443, and voila, emails working again.

Just a heads up to other members ...
Using 3.2, PHP version 7, MySQL 5.5, Host: hostgator shared Linux, Style: Prosilver

sparnkle
Registered User
Posts: 5
Joined: Thu Apr 10, 2014 4:43 am

Re: SSL & invain redirection to domain with :80 added

Post by sparnkle » Sat Jul 14, 2018 4:03 am

This topic is so useful. Thank you for breaking it down this far and step-by-step.

Just to be clear for anyone else looking, these server options are (simply enough) in the control panel under the left hand sub-topic of the default tab. It's called "Server Settings".

Thank you again!

Post Reply

Return to “[3.2.x] Support Forum”

Who is online

Users browsing this forum: Exabot [Bot], jeff.steinkamp and 66 guests