#Hyphen in URL throws 403 error on production only

1 messages · Page 1 of 1 (latest)

dense hollow
#

Why does this route definition works fine in dev but not production?
route("landing-bienvenido", "pages/landing/index.tsx");

The problem is clearly the dash in 'landing-bienvenido'. If I remove it, the url works fine. If not Im getting "Route "pages/landing/index" does not match URL "/landing-bienvenido" but only in production..

dense hollow
#

How this work is very erratic. Removing the hyphen from the url does not request an extra call in the client with this low dash query string I posted above, and the route works fine. If I use a hyphen in the url, then there is this extra client side call with the "_data" parameter that makes this go 403. Im totally baffled

proud sphinx
#

Could you provide a minimal reproduction?

dense hollow
# proud sphinx https://remix.new is super helpful for this

Thanks for the reply. Unfortunately I did try to setup the minimal reproduction but was not succesful, it works there. Same thing as in my local environment, this works. This is not working on my production server (Ubuntu with Nginx server setup). Anything that I can check on my server that could lead me the right way? Not sure how to approach my hosting's customer support about this issue either.

#

Another hint is that if I use the route directory convention, these hyphen url works fine, it's just happening with the manual route definition

proud sphinx
#

It's hard to say - can you run npx remix routes on your app and paste the output here?

dense hollow
#

<Routes>
<Route file="root.tsx">
<Route path="landing-bienvenido" file="routes/landing-bienvenido.tsx" />
</Route>
</Routes>

#

hmm that does not look right, does it

#

That's production, where it is not working

#

let me check locally where it works

#

<Routes>
<Route file="root.tsx">
<Route path="landing-bienvenido" file="pages/landing/index.tsx" />
</Route>
</Routes>

#

I have more routes setup, just pasted the relevant one here

#

These is the file structure Im using

#

And this is my definition:

#

I think I might have found the issue. Be right back

dense hollow
#

I fixed it. Now it's working fine. The problem was totally my fault. Initially all these routes where setup under the routes directory, I migrated most of them to the remix.config.js file, but it turns out that due to my flawed deployment process (I used the cp command to copy files over, these copied but didn't remove the now orphan files under the router directory). Because of this both the router directory and the remix.config.js file had duplicated definitions and ended up colliding. I removed those old route manually on my server and now it's working fine.

thanks @proud sphinx for your help, you totally pointed me in the right direction