chore: revert
2a9884fd
1 file(s) · +17 −1
| 12 | 12 | ||
| 13 | 13 | const app = new Hono<{ Bindings: Env }>(); |
|
| 14 | 14 | ||
| 15 | - | app.use(cors()); |
|
| 15 | + | // Configure CORS to allow credentials from the client |
|
| 16 | + | app.use( |
|
| 17 | + | cors({ |
|
| 18 | + | origin: (origin) => { |
|
| 19 | + | const allowedOrigins = [ |
|
| 20 | + | "https://stevedylan.dev", |
|
| 21 | + | "http://localhost:4321", |
|
| 22 | + | "http://localhost:3000", |
|
| 23 | + | ]; |
|
| 24 | + | return allowedOrigins.includes(origin) ? origin : allowedOrigins[0]; |
|
| 25 | + | }, |
|
| 26 | + | credentials: true, |
|
| 27 | + | allowMethods: ["GET", "POST", "OPTIONS"], |
|
| 28 | + | allowHeaders: ["Content-Type"], |
|
| 29 | + | }), |
|
| 30 | + | ); |
|
| 31 | + | ||
| 16 | 32 | app.route("/", home); |
|
| 17 | 33 | app.route("/now", now); |
|
| 18 | 34 | app.route("/auth", auth); |