-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
chore: Fix env varibles in 404.html #37672
Conversation
WalkthroughThe changes involve updates to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
app/client/public/404.html (2)
30-31
: Consider adding error boundaries around analytics initializationWhile the analytics setup is good, consider adding try-catch blocks around the initialization code to prevent any potential script errors from affecting the page functionality.
if(smartLookId) { + try { window.smartlook||(function(d) { var o=smartlook=function(){ o.api.push(arguments)},h=d.getElementsByTagName('head')[0]; var c=d.createElement('script');o.api=new Array();c.async=true;c.type='text/javascript'; c.charset='utf-8';c.src='https://web-sdk.smartlook.com/recorder.js';h.appendChild(c); })(document); smartlook('init', smartLookId, { region: 'eu' }); smartlook("track", "UserReached404"); + } catch (e) { + console.warn('Failed to initialize analytics:', e); + } }Also applies to: 34-49
Line range hint
94-101
: Enhance refresh mechanism reliabilityThe current refresh implementation using
history.back()
might not work if there's no previous page. Consider these improvements:function refresh() { - history.back(); + if (window.history.length > 1) { + history.back(); + } else { + window.location.href = '/'; + } }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
app/client/public/404.html
(1 hunks)deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs
(2 hunks)
🔇 Additional comments (3)
app/client/public/404.html (1)
30-31
: LGTM: Environment variable syntax updated correctly
The change to use Caddy's template syntax for environment variables is appropriate and aligns with the fix objective.
deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs (2)
228-228
: LGTM! Function name accurately reflects its purpose.
The rename from finalizeIndexHtml
to finalizeHtmlFiles
better represents the function's expanded scope.
252-255
: LGTM! Secure environment variable handling.
The regex pattern ensures only APPSMITH_ prefixed variables are processed, with appropriate fallbacks.
Environment variables in `404.html` page aren't getting replaced with their values. This PR fixes that. ## Automation /test sanity ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12005727044> > Commit: 56b10fd > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12005727044&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: @tag.Sanity > Spec: > It seems like **no tests ran** 😔. We are not able to recognize it, please check <a href="https://github.com/appsmithorg/appsmith/actions/runs/12005727044" target="_blank">workflow here</a>. > <hr>Mon, 25 Nov 2024 08:48:10 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved dynamic retrieval of environment variables for better integration with environment-specific settings in the 404 error page. - Enhanced handling of HTML files, including the 404 page, during the configuration process. - **Bug Fixes** - Improved error handling for missing SSL certificates and custom domains. - **Documentation** - Updated logic for processing HTML files to ensure correct paths and configurations are applied. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Environment variables in
404.html
page aren't getting replaced with their values. This PR fixes that.Automation
/test sanity
🔍 Cypress test results
Warning
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12005727044
Commit: 56b10fd
Cypress dashboard.
Tags: @tag.Sanity
Spec:
It seems like no tests ran 😔. We are not able to recognize it, please check workflow here.
Mon, 25 Nov 2024 08:48:10 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Bug Fixes
Documentation