-
Notifications
You must be signed in to change notification settings - Fork 417
feat: add Netlify deployment config for Console frontend #2362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
malinskibeniamin
wants to merge
7
commits into
master
Choose a base branch
from
bm/console-netlify-deploy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d2f5d42
feat: add Netlify deployment config for Console frontend
malinskibeniamin ed9d2c5
fix: narrow CORS scope and add preflight cache in netlify.toml
malinskibeniamin d588f91
fix: pin BUN_VERSION in netlify.toml for reproducible builds
malinskibeniamin 0a01be8
fix: pin exact BUN_VERSION for reproducible builds
malinskibeniamin 44d329f
fix: split navigateTo into pathname + search for idiomatic router.nav…
malinskibeniamin df13b7e
fix: use indexOf for navigateTo split instead of split('?')
malinskibeniamin 286d804
fix: lower NODE_OPTIONS heap ceiling to 4096 MB
malinskibeniamin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| [build] | ||
| base = "frontend" | ||
| # NODE_OPTIONS: 4 GB is a V8 heap ceiling guard, not actual memory usage. | ||
| # It prevents OOM kills during large builds; real RSS stays well below this. | ||
| command = "bun install && NODE_OPTIONS=--max_old_space_size=4096 bun run build" | ||
| publish = "build" | ||
|
|
||
| [build.environment] | ||
| NODE_VERSION = "22" | ||
| BUN_VERSION = "1.3.11" | ||
|
|
||
| [[headers]] | ||
| for = "/*" | ||
| [headers.values] | ||
| X-Content-Type-Options = "nosniff" | ||
|
|
||
| # MF remote entry — never cached, CORS required for cross-origin import | ||
| [[headers]] | ||
| for = "/embedded.js" | ||
| [headers.values] | ||
| Cache-Control = "no-cache, no-store, must-revalidate" | ||
| Access-Control-Allow-Origin = "*" | ||
| Access-Control-Allow-Methods = "GET, OPTIONS" | ||
| Access-Control-Allow-Headers = "*" | ||
| Access-Control-Max-Age = "86400" | ||
|
|
||
| # MF manifest — never cached, CORS required for cross-origin fetch | ||
| [[headers]] | ||
| for = "/mf-manifest.json" | ||
| [headers.values] | ||
| Cache-Control = "no-cache, no-store, must-revalidate" | ||
| Access-Control-Allow-Origin = "*" | ||
| Access-Control-Allow-Methods = "GET, OPTIONS" | ||
| Access-Control-Allow-Headers = "*" | ||
| Access-Control-Max-Age = "86400" | ||
|
|
||
| # Hashed static assets are immutable, CORS required for cross-origin import | ||
| [[headers]] | ||
| for = "/static/*" | ||
| [headers.values] | ||
| Cache-Control = "public, max-age=31536000, immutable" | ||
| Access-Control-Allow-Origin = "*" | ||
| Access-Control-Allow-Methods = "GET, OPTIONS" | ||
| Access-Control-Allow-Headers = "*" | ||
| Access-Control-Max-Age = "86400" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # SPA fallback for standalone mode. In embedded (MF) mode, only | ||
| # remoteEntry.js/embedded.js and chunks are fetched. | ||
| /* /index.html 200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this how we manage it normally, could we enable CORS only for the specific domains ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. For Module Federation, the host app (Cloud UI on
cloud.redpanda.com) loadsremoteEntry.jsand chunk files from this Netlify site via<script>tags andfetch(). UsingAccess-Control-Allow-Origin: *is standard for public static assets (same pattern as any CDN-served JS library).We could restrict to specific domains (e.g.,
*.redpanda.com,*.netlify.app), but:Access-Control-Allow-Origin: *pattern for external scriptsThe wildcard is scoped to only the MF entry points (
/embedded.js,/mf-manifest.json,/static/*), not all responses. The catch-all/*block only hasX-Content-Type-Options: nosniffwithout CORS. So the exposure is limited to files that are designed to be publicly fetchable.