blocked request with 403 Forbidden

mparisi76
HOBBY

a month ago

Hello. I get the following response when I try to access my app:
Blocked request. This host ("railway-backend-production.up.railway.app") is not allowed. To allow this host, add "railway-backend-production.up.railway.app" to `server.allowedHosts` in vite.config.js.
Where does this vite.config.js live and how to I access/edit this file?

Solved$10 Bounty

1 Replies

mparisi76
HOBBY

a month ago

eff4fdbb-16e0-4ffb-bee2-4ad13f2f307e


Should be in your project's root directory.


root101
HOBBY

a month ago

That looks like a cors config is missing.

You need to have something like this:

// vite.config.js
export default defineConfig({
  //more configs
  server: {
    allowedHosts: [
      'railway-backend-production.up.railway.app'
    ]
  }
});

Status changed to Solved chandrika 24 days ago