Spaces:
Running
Running
fix: proxy /assets/* and all Paperclip static paths to port 3100
Browse filesAdd 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>
- health-server.js +24 -5
health-server.js
CHANGED
|
@@ -178,11 +178,30 @@ app.all("/api/*", async (req, res) => {
|
|
| 178 |
}
|
| 179 |
});
|
| 180 |
|
| 181 |
-
//
|
| 182 |
-
//
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
// ============================================================================
|