Jump to content

Unrecognized HTTP host error persistent


gebeer
 Share

Recommended Posts

Hi all,

after moving a new 2.5 install to a different server, I always get this error message in the backend:

Unrecognized HTTP host: 'subdomain.mydomain.tld' - Please update your $config->httpHosts setting in /site/config.php

The entry in config.php contained the new domain when I installed.

Then I set the entry to an empty array.

$config->httpHosts = array('');

But the error still displays in the backend.

How can I get rid of it?

  • Like 1
Link to comment
Share on other sites

Somewhere in your hosting you would have had to make a change (edit) to reflect that your PW installation is physically at a new location.  If that's been done (automatically or manually), then you need to supply the correct domain name in the PW config.php file so it can pass authentication. 

Link to comment
Share on other sites

The problem happened to be related to old session files that I transferred when moving to the new server.

Once I deleted all session files in assets/sessions on the new server, PW picks up the $config->httpHosts array and the error message in the backend disappears.

  • Like 4
Link to comment
Share on other sites

  • 2 months later...

I have the same issue with 2.5.10 dev even when I remove the old session files.

I've just moved the site from my local environment to the live server and am getting the same error

Unrecognized HTTP host: 'domain.me' - Please update your $config->httpHosts setting in...

domain.me is just for illustration but you get the idea.

This is my config

$config->httpHosts = array('domain.me','www.domain.me' );

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...
  • 2 weeks later...

Having the same problem with a fresh install but only when using CodeKit's preview server.

My config:

$config->httpHosts = array('localhost', 'mac-mini.local:5757', 'myproject.dev');

It only throws the Unrecognized HTTP host error when running the site on CodeKit's test server: mac-mini.local:5757.

Everything seem to work only the red bar is persistent on the top and non of the suggestions helped found in other threads.

The error has been there for the last two projects too.

I tried variations in the config with no luck:

- local:5757

- mac-mini.local

Anyone else using CodeKit with ProcessWire?

What do you think could be the problem?

P.S.: not using the config module, it's a fresh vanilla install on my dev computer.

Link to comment
Share on other sites

  • 1 month later...

Hello. I'm gonna add my two cents here.

I am just setting up my very first PW multi-site installation (Oh, the emotion...), following the tutorial. (two databases, with a site-secondsite folder). So it is a fresh, blank install, on a local LAMP.

I do get that same error.

However, the fun fact is : I only get it when I log in to the second-site.com admin ("site-second" folder). The "main" site ("site" folder) throws no error at me.

II first thought I made a mistake installing the "site-second" folder. But I now doubt it. Sounds sane to me. (unless I have to declare both sites' URL in each config.php, which would make little sense, I guess)

And yes, I have declared the second site in index-config.php.

'second-site.com' => 'site-second',
'www.second-site.com' => 'site-second',

Funnier fact is :

Unrecognized HTTP host: 'second-site.com' - Please update your $config->httpHosts setting in /site/config.php

Uh ? Should'nt I get, at least  : please update site-second/config.php ?

Beats me. o_O

Cleaning assets/sessions doesn't help.

However, the sites' admin both seem to work correctly. (I'll only be sure when I start creating specific content/templates. But that will be tomorrow. And if then I realise I simply and miserably failed my multi-site config, I will come back and apologize. :biggrin: )

Link to comment
Share on other sites

  • 11 months later...

another reason could be that you setup 2 vagrant machines to test import/export of fields and forgot to give them different ips, so you have different hosts, 2 machines but in fact only one served website (one working, one giving the httphost error) :D

Link to comment
Share on other sites

  • 1 year later...

The answer to the original question seems to be:

// use this
$config->httpHosts = array();
// instead of this
$config->httpHosts = array('');

I guess the 2nd line creates an array with an empty item, not an empty array.

But I still have a problem with empty httpHosts config on https sites. They just do not want to work without $config->httpHosts set explicitly.

  • Like 2
Link to comment
Share on other sites

  • 2 years later...
On 8/30/2017 at 3:23 AM, Ivan Gretsky said:

The answer to the original question seems to be:


// use this
$config->httpHosts = array();
// instead of this
$config->httpHosts = array('');

I guess the 2nd line creates an array with an empty item, not an empty array.

But I still have a problem with empty httpHosts config on https sites. They just do not want to work without $config->httpHosts set explicitly.

Over two years later with PW 3.0.123 I was getting the above mentioned error about

Unrecognized HTTP host

 

I emptied out the httpHosts = array(); and the error went away.

TESTED. CONFIRMED. Working in 2019 running PW 3.0.123 ? ? ?

Link to comment
Share on other sites

  • 4 months later...

I'm getting this now. I installed an SSL certificate to log in securely and now I get this error. Only thing is, the site is old, first done in 2013 with PW 2.X so the site config file actually has no $config->httphosts setting.

I added it to the config file and it seems to be working.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...