Skip to content

Preview middleware serves HTML without a Content-Type header #142

Description

@uhyo

Problem

The preview-server middleware in packages/static/src/plugin/server.ts (configurePreviewServer) responds with res.end(html) without setting any Content-Type header — both for matched entry files and for the SPA fallback. Browsers generally sniff it as HTML, but the response should be explicit (and some environments/tools won't sniff).

Suggested fix

Set res.setHeader("Content-Type", "text/html; charset=utf-8") before res.end(html). The two lookup loops (candidate files, then SPA fallback over index.html/index.htm) could also be collapsed into a single candidate list while touching this code.

Found during a framework audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions