Something went wrong. Try again.
Website hub for the atmosphere community, aggregating posts, events, regional, and more
Something went wrong. Try again.
569 B · 14 lines
TypeScript
123456789101112131415import { defineMiddleware } from "astro:middleware";
// Keep dev traffic on 127.0.0.1: ATProto OAuth callbacks always come back on// 127.0.0.1, so a stray localhost session ends up with cookies on a different// origin than the post-login session — login appears to silently fail.export const onRequest = defineMiddleware(async (context, next) => { if (import.meta.env.DEV && context.url.hostname === "localhost") { const url = new URL(context.url); url.hostname = "127.0.0.1"; return context.redirect(url.toString(), 307); }
return next();});