www/apps/resources/app/troubleshooting/_sections/admin/blocked-request.mdx
If you see the following error in the Medusa Admin's console:
Blocked request. This host (X) is not allowed. To allow this host, add X to server.allowedHosts in vite.config.js.
Where X is the host that's being blocked. For example, example.com.
This error occurs if you deploy Medusa but are using development mode (NODE_ENV=development). This can happen accidentally or unintentionally, but Medusa defaults NODE_ENV to production.
To resolve this error, ensure that you're running Medusa in production mode. You can set the NODE_ENV environment variable to production when starting Medusa:
NODE_ENV=production
If you intentionally want to use development mode in your deployed Medusa instance, you can allow the host that's being blocked using the admin.vite configuration in medusa-config.ts.
For example:
module.exports = defineConfig({
// ...
admin: {
vite: () => {
return {
server: {
allowedHosts: [".example.com"],
},
}
},
},
})
In the above example, you allow the host example.com to access the Medusa Admin. Make sure that when you replace example.com with your actual host, you include the leading . before the domain name.