Jump to content
gebeer

Unrecognized HTTP host error persistent

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

Share this post


Link to post
Share on other sites

If you have moved to a different server, have you ensured that all your path statements reflect the move (different physical location of files) on this install?

Share this post


Link to post
Share on other sites

Which path statements do you mean? Are they stored in the DB or in some config file? Can't find anything related to paths in config.php.

Share this post


Link to post
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. 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Anyone get this resolved? I'm having the same issue and I'm working with a fresh install. Clearing the sessions aren't working for me.

Share this post


Link to post
Share on other sites

I have found myself dealing with similiar problem. In my case it was because of ProcessWire Config module installed. It seems like it replaces config options on runtime (does not add them). So If you use that module you have to add HTTP hosts to the whitelist via the module.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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: )

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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 😄 😛 🙂

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By usualCommission
      Hey all. I'm having an issue with the new custom page classes feature which is a fantastic tool.
      I am running into a recursion issue when attempting to call a custom page class. I have a class called BlogPostPage.php (for blog-post.php) which contains a method called getSummary(). That method gets a summary field or truncates the body in it's absence. I've attached photos of the template code, custom page class code (which I've simplified for testing), and the PW output error.
      There is no recursion in the getSummary() method. This error occurs whether I output multiple blog posts in a loop or if I output one blog post with no looping in my template code.

      In use:
      ProcessWire 3.0.164 dev
      PHP 7.3.13

      I am also using the Template Engine Twig module which has not caused any errors or issues thus far.
      Many thanks!



    • By neonwired
      I'm hoping someone has seen this before. There doesn't appear to be an issue with the user info.

       

    • By EyeDentify
      Hello Dear PW Gurus.

      Hope you fair well in these Corona Crisis times.

      Anyhow, i have a problem with a Cryptic error message that shows up when i am trying to Delete images out of a Images field.
      The Error message does say a little but it does not make sense to me why i can´t delete the images because of it.

      Is it some permission issue perhaps?

      I will attach screenshots of it and what i did prior to it.
      I am from sweden so ignore the funny words here and there.

      Hope you all can send me on the right track.
      i am running PW 3.0.139 on this install.

      Step1:

      Step 2: Select the images with the trashcan symbol

       
      Step 3: Cryptic Error message

      I am scratching my head on this one, have not seen this before.

      Thankfull for all help.
      /EyeDentify
    • By VeiJari
      Hello forum. I'm trying to figure out how to detect if current form has errors after saving it in pw admin page. This is so that our event location isn't added in database if we detect errors. But I can't seem to find a correct way to detect errors? I only found the wire()->errors() and it always triggers even if I don't have any errors. 
      How can I detect errors in a form?
      By error I mean $page->error('this is the red error');
    • By DevCat
      Hi,
      I'm trying to install ProcessWire on XAMPP localhost. I extracted the zip and put the files from master folder to website directory folder and when I go there with Firefox it says 404 page not found (no site configuration or install.php available). At least install.php surely is there. I'm doing WordPress installations on localhost almost every day and no problems. Does anyone here know what is cause for this error?
×
×
  • Create New...