blocked request with 403 Forbidden
mparisi76
HOBBYOP

8 months 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

Pinned Solution

root101
HOBBY

8 months 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'
    ]
  }
});

3 Replies

mparisi76
HOBBYOP

8 months ago

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


8 months ago

Should be in your project's root directory.


root101
HOBBY

8 months 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 8 months ago


Loading...