Can't fetch posts because of invalid header

Hi,

I have switched the domain on a website im working on, and you can reach the website fine on the new domain: beta.arctic-bioscience.com. But now when i try to navigate aroun the website, none of the pages loads, and I get this error in the console. The header value there is the old domain. How do I get it to refresh?

image

Hi @kasper

Does this problem occur with your local development version? Where is your site hosted? Have you tried contacting their support to see if the changed domain problem is something that’s occurring on their end? Can you post the content of your frontity.settings.js file here please, or better still, a link to a repo with your project code.

Hi @mburridge

We host the wp website on a vps. This does happen in local development as well, yes.

Hi @kasper ,

I had a similar issue a while back. In my case I had the settings incorrect in the wp admin.

WordPress Address (URL)	
Site Address (URL)

Not sure if that is your case, but it might be worth checking. If that doesn’t work I’d do a mysqldump then search/replace for the old domain.

Good luck,
Maurice

Hi @maurice.tadros !

It is not the wordpress domain that throws the error, it is the frontity domain. I changed my frontity domain from arcticbioscience.vercel.app to beta.arctic-bioscience.com. But in the requests that the frontity site sends to wordpress, it apparently still uses the old domain in the header.

When I looked in the console now, on the live website, it had the localhost:3000 as the domain in the header…

image

I had this plugin installed, by @luisherranz:

I deleted it, and the problem went away.

3 Likes

@kasper, if you want to use that plugin to cache the REST API and store the headers (including CORS, if you have them), you need to install the branch of the PR: GitHub - luisherranz/simple-cache at rest-api-and-headers-support

You can download it, rename the folder (the plugin has the folder simple-cache hardcoded) and then activate the options:

  • Cache the REST API.
  • Store the headers.