Self-hosting Fluxer: findings, bugs, and patches from a real deployment

(#1037) Feature Shipped self-hosting

Thread

Comment by @mgabor3141
RexSystem 1 vote originally by @mgabor3141 on GitHub OP

2: Self-hosted asset serving and CSP

Note
I ended up using the Fluxer CDN instead, so this point is not that relevant. See the CDN fix below.
Problem: rspack.config.mjs sets publicPath to ${CDN_ENDPOINT}/ in production. Since the CDN hosts the upstream builds, self-hosted instances must serve JS/CSS bundles from their own origin. Fix in rspack.config.mjs:
- publicPath: isProduction ? `${CDN_ENDPOINT}/` : '/'
+ publicPath: '/'
Static assets (emoji SVGs, fonts, icons) can still be served from fluxerstatic.com — they're not instance-specific. But the CSP directives in ServiceInitializer.tsx don't include static_cdn_domain, so browsers block them. Fix in fluxer_server/src/ServiceInitializer.tsx:
const staticCdnHost = new URL(requireValue(config.endpoints.static_cdn, 'endpoints.static_cdn')).origin;
Then add staticCdnHost to imgSrc, styleSrc, and fontSrc arrays.