Skip to content

mod-blocks preview: a HEAD 404 skips the build-time framing check #2287

Open

Description

@markdumay

The preview block's build-time framing check (mod-blocks v2.13.0, layouts/partials/assets/preview.html) retries a HEAD request with GET only when $response.Err is set. Hugo's resources.GetRemote returns no resource and no error for a 404, so a target that answers HEAD with 404 is never re-checked with GET. Hugo then warns Request to '<url>' failed: <nil>. Rendering the preview anyway. and renders the block live, even when GET would return X-Frame-Options: DENY or a restrictive CSP frame-ancestors.

Reproduction: run a local server that answers 404 to HEAD, and 200 with X-Frame-Options: DENY to GET. Allow the server in the site's frame-src and render a preview of it. The server logs only the HEAD request. The iframe has no d-none.

Impact: low. At runtime, the readiness/timeout fallback still covers a frame that the browser refuses. The build-time fallback and its warning are skipped, and the warning text "failed: " is misleading.

Possible direction: also retry with GET when HEAD yields no resource (not $response.Value), or when it yields a non-2xx status.

Found by an independent review of the mod-docs preview documentation (#2268, Amfelt homepage live-demo program). Filed separately; this is not a change to the released v2.13.0 scope. The docs now describe the current behavior.

Activity

  1. added theissue type on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions