+11
hosting-service/src/server.ts
+11
hosting-service/src/server.ts
···
1
1
import { Hono } from 'hono';
2
+
import { cors } from 'hono/cors';
2
3
import { getWispDomain, getCustomDomain, getCustomDomainByHash } from './lib/db';
3
4
import { resolveDid, getPdsForDid, fetchSiteRecord, downloadAndCacheSite, getCachedFilePath, isCached, sanitizePath, shouldCompressMimeType } from './lib/utils';
4
5
import { rewriteHtmlPaths, isHtmlContent } from './lib/html-rewriter';
···
537
538
}
538
539
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
+
}));
540
551
541
552
// Add observability middleware
542
553
app.use('*', observabilityMiddleware('hosting-service'));