fix(pages): Let the 500 page's links escape their iframe (backport #585) - #586
Merged
Conversation
nginx injects this page as <iframe src="/internal_server_error.html">, so a link without a target loads its destination inside the frame. Both docs.frappe.io and frappecloud.com send X-Frame-Options: SAMEORIGIN, so the browser refuses to render either one and shows a security error in place of the page. Predates this branch: the links on develop have the same problem. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> (cherry picked from commit 578efe5)
_blank escapes the iframe the same way _top does, since a new top-level tab is never framed, and it leaves the error page on screen. That keeps the visited-link colour visible for support screenshots. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> (cherry picked from commit ad61b7f)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Both links on the 500 page are dead in the browser. Clicking either one shows a browser security page instead of the destination:
nginx does not serve this page directly. It injects it through
sub_filteras a frame:An anchor with no
targetnavigates the frame it lives in, so the destination is asked to render inside that iframe. Both destinations refuse:This is live on
developand affects both the troubleshooting guide button and theweb.error.loglink added in #581.Fix
target="_blank"on both anchors. A new top-level tab is never framed, soX-Frame-Optionsdoes not apply to it._topwould also have worked, but it replaces the error page._blankleaves it on screen, which keeps the visited-link colour visible — useful when someone attaches a screenshot to a support ticket and we want to see whether they already opened the guide.Test
test_iframed_pages_escape_the_framereads the nginx template, finds which pages get wrapped in an iframe, and requires every external link on those pages to carry a target that escapes the frame (_blankor_top). Checked against the pre-fix page, it flags both anchors, so it fails without this change rather than passing vacuously.🤖 Generated with Claude Code
This is an automatic backport of pull request #585 done by [Mergify](https://mergify.com).