Getting "Invalid Host Header" when using custom domain with glitch project

I have a custom domain that I am using for a glitch project.

I followed the given instructions for setting up an A record to point to the fly domain output by my project (after pinging for IP), and now when I try to visit the url I get Invalid Host header as a response.

complicating issues, within the glitch UI it seems like I do not have the URL connected anymore. When I try to re-add the custom domain, it tells me it is already taken. I went to the site manager at fly io to see if I can control it from there, but they also say it is already taken. The autogenerated shw page is showing “not found” as well. Despite this, the previous Host Header issue is still visible on my custom domain pointing to the missing autogenerated site. Should I be managing this through fly’s website?

if you wish to see the website for yourself, the url is and the project is

There is a link limit for new users, so I am posting again to say that the temporary link generated by my project was

I pointed an A record to the IP address I got pinging the temporary page

Hi @CatLover91, welcome to the Glitch forum!

Yes there are a few limitations to the current Custom Domain implementation, among them that you can’t view or manage assigned Custom Domains once they’ve been assigned. I can confirm that your domain is properly associated with the project, and it seems like your DNS configuration is just fine. Navigating to the provided url is not expected to render anything useful, so the “not found” you see there is also expected.

I think what may be happening here is that your start script specifies to render the public site at your project’s domain, so when it’s accessed from your custom domain the Host header doesn’t match. Perhaps if you update that script things will look better?

1 Like

That does look to be an issue, but it doesn’t seem to resolve the problem. I updated my package.json’s scripts as follows:

"scripts": {
    "start": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --host --public",
    "dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --host --public",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"

but I still see the Invalid Host Header at

you mention that my custom domain configuration on glitch’s end is properly configured, but I do not see the usual confirmation for an attached domain in the project UI
is it normal for custom domain confirmation to disappear from this section over time?

That is correct, you can’t view or manage Custom Domains once they’ve been assigned at the moment, so they won’t appear there.

As far as your webpack config (which I still suspect is what’s causing the error you’re seeing) it seems like there are few options listed in answers to

1 Like

I updated my webpack.config by disabling the hostname check, and that fixed it:

  devServer: {
    disableHostCheck: true,
    historyApiFallback: true,
    noInfo: true,
    overlay: true

the fix works perfectly, thank you for being patient with me

1 Like

Glad you found the solution; we’re always happy to help!

1 Like