Strapi 5
node 20
Started in develop mode through pm2, the domain is not localhost, I think it’s the reason I have this issue.
It starts but will not let me access it with the below error:
Blocked request. This host (“x.com”) is not allowed.
To allow this host, add “x.com” to server.allowedHosts in vite.config.js.
I don’t know where I should be placing the vite config file, I tried different option and cannot get it to work.
I install the last version of strapi.
node 20
After spending many hours on this issue I’m giving up.
It appears that it is now not possible to run strapi in develop mode on a domain with https, because of the new VITE requirement.
I wanted to have an instance of strapi always running in development mode at a specific domain path.
This configuration will not work an gives the error above. The only way to get it working is through doing run develop on the command line and access strapi through the IP address. http://x.x.x.x:1337
Admin panel bundlers | Strapi 5 Documentation has details on how to add to the vite.config.js/ts file. There should already be an example file in your project in the src/admin directory. Rename it from vite.config.example.ts (or js) to vite.config.ts and then replace the existing example config with an entry for server.allowedHosts like you see in the error message.
My entire config (I’m using TypeScript) now looks like:
I didn’t see a need for this feature, so I set the value to true, which allows everything. You could replace the boolean with a string containing the value you want to allow.