Conversation
Update angular.json to include "src/static-files" in the build assets array so files placed there are copied into the build output. This ensures additional static resources are available at runtime without changing code paths.
There was a problem hiding this comment.
Pull request overview
This pull request fixes an SSR issue where static HTML files in the src/static-files/ directory were not being copied to the production build output, causing 404 errors when accessed via server-side rendering. The fix adds "src/static-files" to the assets array in the angular.json build configuration, ensuring these files are copied to dist/browser/static-files/ during the build process.
Changes:
- Updated angular.json to include "src/static-files" in the build assets array, following the same pattern as existing assets like "src/assets" and "src/robots.txt"
|
@amadulhaxxani I'm not sure this works as it's supposed to. The idea was that the static pages (namely license texts) will be available to clients with no javascript support (such as curl, (e)links, or any python script). this doesn't contain the license name NOTE: |
Update angular.json to include "src/static-files" in the build assets array so files placed there are copied into the build output. This ensures additional static resources are available at runtime without changing code paths.
Problem description
Static HTML files located in src/static-files/ were not included in the production SSR build output.
During server-side rendering, StaticPageComponent fetches these files via HttpClient. In production, the request resolves against dist/browser/, but since the files were not copied there, SSR returned 404 responses and static pages were not rendered correctly when accessed via tools like curl.
Analysis
The issue was caused by missing asset configuration in angular.json.
Adding "src/static-files" to the assets array ensures the files are copied into dist/browser/static-files/ during build, making them accessible at runtime for SSR without requiring changes to component or service logic.
Problems
No unexpected issues occurred. Build and SSR rendering were verified locally. Static pages now return HTTP 200 and correct content when accessed via curl.
Copilot review