Hi,
For Angular projects, you must configure a URL rewrite to redirect all URLs to the index.html file.
See:
For the “Routing” to work properly, it is important to implement a “rewrite” rule on your hosting platform so that all the “routes” return the same index.html file produced in the dist folder during the "build " (thread construction).
Otherwise, by directly accessing a “route” of the application, the user would get a 404 error.
The Proxying method is not supported for now, it is possible to add this feature soon?
Currently Angular projects are not 100% functional with Cloudflare Pages…
Example of _redirects
/:lang/* /:lang/index.html 200
If I’m understanding your request correctly, you should be able to accomplish this by simply not including a 404.html
in your project, and only an index.html
. Pages should then use its SPA routing:
Or do you mean multiple different index.html
files depending on subfolders?
This is already the case, my project does not have a 404.html file
Yes, when the Angular project is configured with internationalization, the build phase will create as many static sites as there are languages in the subfolders:
dist/project-name/fr/
dist/project-name/en/
etc…
My project structure:
dist
└── project-name
├── _redirects
├── en
│ ├── 3rdpartylicenses.txt
│ ├── assets
│ │ ├── logo-white.svg
│ │ └── logo.svg
│ ├── favicon.ico
│ ├── index.html
│ ├── main.dc438e4ad93f3d58.js
│ ├── polyfills.ca188808501e52f4.js
│ ├── runtime.31f4cb431c3288bd.js
│ └── styles.ef46db3751d8e999.css
├── fr
│ ├── 3rdpartylicenses.txt
│ ├── assets
│ │ ├── logo-white.svg
│ │ └── logo.svg
│ ├── favicon.ico
│ ├── index.html
│ ├── main.dc438e4ad93f3d58.js
│ ├── polyfills.ca188808501e52f4.js
│ ├── runtime.31f4cb431c3288bd.js
│ └── styles.ef46db3751d8e999.css
└── robots.txt