Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2021-03-12 10:59:21

petecooper
Member
Registered: 2020-11-19
Posts: 6

Bad HTTP_REFERER after subdomain move, `o_base_url` is correct

Hello.

I've moved a FluxBB instance to a new subdomain. I've set the new subdomain in `config.php`, and also in the `o_base_url`row. I have cleared the contents of `/cache/`.

I can log in and navigate read-only just fine, but cannot make changes. Any change throws the error:

Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.

Nothing in the console. Nothing useful from debug mode.

Is there something else I've missed from the to-do list?

Thank you in advance.

Offline

#2 2021-03-12 11:47:04

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,480
Website

Re: Bad HTTP_REFERER after subdomain move, `o_base_url` is correct

1. Remove the slash at the end of o_base_url
2. Make sure you don't misspelling o_base_url

Offline

#3 2021-03-12 15:26:16

petecooper
Member
Registered: 2020-11-19
Posts: 6

Re: Bad HTTP_REFERER after subdomain move, `o_base_url` is correct

Hello Visman. Thank you for your reply.

I confirm there is no trailing slash on `o_base_url`, and I confirm there is no misspelling of the `o_base_url` value:

aiDHg5b.png

Offline

#4 2021-03-12 15:48:08

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,480
Website

Re: Bad HTTP_REFERER after subdomain move, `o_base_url` is correct

1. set o_redirect_delay = 600
2. open include/functions.php

3. after

//
// Make sure that HTTP_REFERER matches base_url/script
//
function confirm_referrer($scripts, $error_msg = false)
{
	global $lang_common;

add

echo "<pre>\n";
var_dump(pun_htmlspecialchars($_SERVER['HTTP_REFERER']));
echo "</pre>\n";

4. replace

		$valid = parse_url(strtolower(get_base_url().'/'.$script));
		// Remove www subdomain if it exists

to

		$valid = parse_url(strtolower(get_base_url().'/'.$script));
echo "<pre>\n";
var_dump(pun_htmlspecialchars(get_base_url().'/'.$script));
echo "</pre>\n";
		// Remove www subdomain if it exists

5. save file
6. test submit form
7. show here what will be displayed at the top of the redirect / error page

P.S. my output is like this:

string(37) "http://fluxbb.local/admin_options.php"

string(37) "http://fluxbb.local/admin_options.php"

Offline

#5 2021-03-12 16:00:18

petecooper
Member
Registered: 2020-11-19
Posts: 6

Re: Bad HTTP_REFERER after subdomain move, `o_base_url` is correct

Hello Visman.

I made the changes to `o_redirect_delay`:

JoAAVHj.png

I made the changes to `include/functions.php`:

CYWU0G5.png

And my output is like this:

string(30) "https://murof.textpattern.com/"
string(47) "https://murof.textpattern.com/admin_options.php"

Last edited by petecooper (2021-03-12 16:00:47)

Offline

#6 2021-03-12 16:13:44

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,480
Website

Re: Bad HTTP_REFERER after subdomain move, `o_base_url` is correct

Your Referrer-Policy seems too aggressive smile

referrer-policy: strict-origin

https://developer.mozilla.org/en-US/doc … rer-Policy

Try changing the title to:

referrer-policy: origin-when-cross-origin

Offline

#7 2021-03-12 16:19:42

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,480
Website

Re: Bad HTTP_REFERER after subdomain move, `o_base_url` is correct

https://forum.textpattern.com/ have

referrer-policy: strict-origin-when-cross-origin

Offline

#8 2021-03-12 16:22:15

petecooper
Member
Registered: 2020-11-19
Posts: 6

Re: Bad HTTP_REFERER after subdomain move, `o_base_url` is correct

Hello Visman.

Thank you very much - this was the problem. Solved by:

referrer-policy: origin-when-cross-origin

Offline

Board footer

Powered by FluxBB