somratpro Claude Haiku 4.5 commited on
Commit
9cb2a61
·
1 Parent(s): c1db737

fix: proxy /assets/* and all Paperclip static paths to port 3100

Browse files

Add catch-all route so absolute asset URLs (/assets/*, /site.webmanifest,
/favicon.*) generated by Paperclip's Vite build are forwarded correctly.
Remove duplicate app.get("/") route.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. health-server.js +24 -5
health-server.js CHANGED
@@ -178,11 +178,30 @@ app.all("/api/*", async (req, res) => {
178
  }
179
  });
180
 
181
- // ============================================================================
182
- // Default Route - Redirect to Dashboard
183
- // ============================================================================
184
- app.get("/", (req, res) => {
185
- res.send(getDashboardHTML());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  });
187
 
188
  // ============================================================================
 
178
  }
179
  });
180
 
181
+ // Catch-all: proxy /assets/*, /site.webmanifest, /favicon.* and any other
182
+ // paths Paperclip's UI references with absolute URLs directly to Paperclip.
183
+ app.all("*", async (req, res) => {
184
+ const targetUrl = `http://${PAPERCLIP_HOST}:${PAPERCLIP_PORT}${req.url}`;
185
+
186
+ try {
187
+ const response = await proxyRequest(
188
+ req.method,
189
+ targetUrl,
190
+ req.headers,
191
+ req.body,
192
+ );
193
+
194
+ Object.keys(response.headers).forEach((key) => {
195
+ res.setHeader(key, response.headers[key]);
196
+ });
197
+
198
+ res.status(response.statusCode).send(response.body);
199
+ } catch (error) {
200
+ res.status(503).json({
201
+ error: "Paperclip service unavailable",
202
+ details: error.message,
203
+ });
204
+ }
205
  });
206
 
207
  // ============================================================================