coolify: [Bug]: Strapi "host is not allowed" error

Error Message and Logs

Latest version of Strapi image doesn’t work after deployment. Admin panel always returns host error:

Blocked request. This host ("cms.xxx.app") is not allowed.
To allow this host, add "cms.xxx.app" to `server.allowedHosts` in vite.config.js.

Steps to Reproduce

  1. Deploy Strapi instance from Coolify marketplace template
  2. Try accessing Strapi instance host / domain

Example Repository URL

No response

Coolify Version

v4.0.0-beta.400

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Debian 6.1.128-1 (2025-02-07) x86_64

Additional Information

Error appears on both generic and custom domains. I was able to deploy Strapi before on the same Coolify instance.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 13
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I had to edit the vite.config.js file

once you are connected via the terminal in the coolify project, you can run

cd src/admin
apt-get install nano
nano vite.config.js

and add the allowedHosts flag:

const { mergeConfig } = require('vite');

module.exports = (config) => {
  // Important: always return the modified config
  return mergeConfig(config, {
    resolve: {
      alias: {
        '@': '/src',
      },
    },
    server: {
      allowedHosts: true
    }
  });
};

after I restarted the container, just in case. But the backend took a solid minute to be accessable even after restarting.

The elestio/strapi-development image seems to be at fault here No idea where the source Dockerfile is, repository seems to be privated/deleted

Our competitors have been referencing our repository to create their own infrastructure repositories. To protect our code base, we have decided to make it private. However, you can deploy the service with us and customize the code to suit your needs.

I change the image to “elestio/strapi-production” and it worked… only problem when I set a custom domain I always get “no available server”. Did someone have the same issue?

I change the image to “elestio/strapi-production” and it worked… only problem when I set a custom domain I always get “no available server”. Did someone have the same issue?

For those who using Coolify this works for me.

The root cause might be related to the default Docker image used for Strapi deployments (elestio/strapi:development). This image runs yarn develop, which starts Strapi in development mode. In this mode, the admin panel is served via Vite’s dev server, which enforces host restrictions and throws errors unless the domain is explicitly listed in server.allowedHosts inside vite.config.js.

This explains the “Blocked request. This host is not allowed” error users are seeing when accessing the generated Coolify domain (e.g. *.sslip.io).

A quick fix is to override the container’s command in the Compose file to use:

command: yarn start

…which runs Strapi in production mode, serving the pre-built admin panel without Vite — and avoids the host restriction issue entirely.

I’m not entirely sure why the current image uses entrypoint.sh && yarn develop. When I inspected the entrypoint.sh file, its only content was:

yarn add @strapi/provider-email-nodemailer

This seems unusual for an entry point, but there might be a reason.

Happy to help test or contribute further if needed!

EDIT: I understand now… It’s because you might need to make some development actions, and to do so, you need to be in development mode.

Just do it yourselves and use nixpacks + env variables. The coolify strapi setup is not ideal and doesnt really make sense for strapi, in my opinion.

fyi strapi env vars need

HOST=0.0.0.0
HOSTNAME=0.0.0.0

for some reason

Image

Image

The elestio/strapi-development image seems to be at fault here No idea where the source Dockerfile is, repository seems to be privated/deleted