🚀 Feature Request: Add File Type Filtering to Redirects in Pages #13533
benwk
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the solution
Background
One of my projects involves migrating an Angular Single Page Application (SPA) with multiple language support to Cloudflare Pages. This necessitates a directory structure based on languages (e.g.,
/en-us,/fr-ca,/zh-cn). While Nginx allows for sophisticated URL rewrite rules to handle this, Cloudflare Pages' redirect rules are currently too explicit and can cause MIME type issues when not correctly configured.Problem Statement
The lack of file type filtering in
_redirectsrules has made it difficult to migrate applications with multi-directory structures, causing MIME type mismatches in browsers. For instance, if you try to redirect everything under/en-us/*to/en-us/with200, then.jsand.cssfiles also get redirected, causing MIME type errors.Proposed Solution
The feature request aims to add file type filtering capabilities to the redirect rules within the
_redirectsfile of Cloudflare Pages. The rules should be able to distinguish between HTML, JS, and CSS files to avoid MIME type errors.Example Configuration
Benefits
Summary
By implementing file type filtering in redirect rules, Cloudflare Pages would significantly improve its usability and compatibility, making it more attractive for developers who have complex, multi-directory applications.
Beta Was this translation helpful? Give feedback.
All reactions