Cli: redirects should not redirect requests for existing files

Created on 28 Jun 2019  路  6Comments  路  Source: netlify/cli

- Do you want to request a feature or report a bug?
bug

- What is the current behavior?
a simple single page app redirect rule:

/*    /index.html   200

ironically breaks most SPA's because the requests for js bundles ALSO redirects to index.html.

image

this is not how redirects work in production. we check first if there are existing files.

- If the current behavior is a bug, please provide the steps to reproduce.

the offending code is either https://github.com/netlify/netlify-dev-plugin/blob/master/src/commands/dev/index.js#L109-L129

or https://github.com/netlify/netlify-rules-proxy/blob/master/index.js#L163

depending where we want to fix this.

dev

Most helpful comment

this is the top top top issue right now and will be fixed.

All 6 comments

I can confirm this behaviour. I have to comment out my redirection when I develop local. Please fix this.

this is the top top top issue right now and will be fixed.

cc @raeesbhatti

I'm looking at the redirect issues right now.

@sw-yx I'm unable to reproduce this issue here: https://github.com/raeesbhatti/netlify-redirect-test. Can you please provide a more elaborate example!

please use CRA

Was this page helpful?
0 / 5 - 0 ratings