Files
morulia/next.config.ts
CatoandClaude abb53a2fab fix(headers): same-origin referrer policy so the sign-in form can start (#37)
With `Referrer-Policy: no-referrer` browsers send `Origin: null` on the
same-origin POST to /start. start() requires its own origin, so every
provider button ended on /problem?error=start_failed. Found live on
2026-11-10, the first time a provider (Google) was switched on; the tests
call the handler with `origin` set by hand and could not see it.

`same-origin` keeps what no-referrer was for (nothing about a sign-in
reaches a provider or any other site) and lets the form send its origin.
Checked in Chromium: no-referrer -> `Origin: null`, same-origin -> the origin.
A test pins the policy.


Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 08:53:30 +01:00

30 lines
1.0 KiB
TypeScript

import type { NextConfig } from "next";
const config: NextConfig = {
// deploy.sh (loki scripts/hetzner) ships .next/standalone and refuses a build without it.
output: "standalone",
poweredByHeader: false,
async rewrites() {
return [{ source: "/.well-known/:name", destination: "/api/well-known/:name" }];
},
async headers() {
return [
{
source: "/:path*",
headers: [
{ key: "X-Frame-Options", value: "DENY" },
// NOT "no-referrer": under it a browser sends `Origin: null` on this
// service's own sign-in form, `start()` (lib/http.ts) requires its own
// origin, and every provider button ended on /problem. "same-origin"
// keeps the privacy that was wanted (nothing about the sign-in reaches
// a provider or any other site) and lets the form say where it is from.
{ key: "Referrer-Policy", value: "same-origin" },
{ key: "X-Content-Type-Options", value: "nosniff" },
],
},
];
},
};
export default config;