Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place

how could i forget cors

Changed files
+11
hosting-service
src
+11
hosting-service/src/server.ts
··· 1 import { Hono } from 'hono'; 2 import { getWispDomain, getCustomDomain, getCustomDomainByHash } from './lib/db'; 3 import { resolveDid, getPdsForDid, fetchSiteRecord, downloadAndCacheSite, getCachedFilePath, isCached, sanitizePath, shouldCompressMimeType } from './lib/utils'; 4 import { rewriteHtmlPaths, isHtmlContent } from './lib/html-rewriter'; ··· 537 } 538 539 const app = new Hono(); 540 541 // Add observability middleware 542 app.use('*', observabilityMiddleware('hosting-service'));
··· 1 import { Hono } from 'hono'; 2 + import { cors } from 'hono/cors'; 3 import { getWispDomain, getCustomDomain, getCustomDomainByHash } from './lib/db'; 4 import { resolveDid, getPdsForDid, fetchSiteRecord, downloadAndCacheSite, getCachedFilePath, isCached, sanitizePath, shouldCompressMimeType } from './lib/utils'; 5 import { rewriteHtmlPaths, isHtmlContent } from './lib/html-rewriter'; ··· 538 } 539 540 const app = new Hono(); 541 + 542 + // Add CORS middleware - allow all origins for static site hosting 543 + app.use('*', cors({ 544 + origin: '*', 545 + allowMethods: ['GET', 'HEAD', 'OPTIONS'], 546 + allowHeaders: ['Content-Type', 'Authorization'], 547 + exposeHeaders: ['Content-Length', 'Content-Type', 'Content-Encoding', 'Cache-Control'], 548 + maxAge: 86400, // 24 hours 549 + credentials: false, 550 + })); 551 552 // Add observability middleware 553 app.use('*', observabilityMiddleware('hosting-service'));