From eef6d0cb7d1fe1e9554d65914cb437ed6dcba579 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 16 Jun 2026 08:05:29 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20gallery/server=20workarounds=20?= =?UTF-8?q?=E2=80=94=20fixed=20in=20NPMplus=20instead?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The root cause (wrong port 5001 vs 5002 in NPMplus /uploads location) is now fixed. Remove the window.location.origin fallback and the Express proxy routes that were added while diagnosing the issue. Co-Authored-By: Claude Sonnet 4.6 --- main-site/gallery/gallery.js | 1 - main-site/server.js | 23 ----------------------- 2 files changed, 24 deletions(-) diff --git a/main-site/gallery/gallery.js b/main-site/gallery/gallery.js index 0f693c9..061fd8c 100644 --- a/main-site/gallery/gallery.js +++ b/main-site/gallery/gallery.js @@ -80,7 +80,6 @@ document.addEventListener('DOMContentLoaded', () => { const apiBaseCandidates = (() => { const hints = [ window.GALLERY_API_URL || '', - window.location.origin, 'https://photobackend.beachpartyballoons.com', ]; return [...new Set(hints.filter(Boolean))]; diff --git a/main-site/server.js b/main-site/server.js index 75ef478..c2f1612 100644 --- a/main-site/server.js +++ b/main-site/server.js @@ -250,29 +250,6 @@ apiRouter.post('/contact', upload.array('photos', 3), async (req, res) => { // Mount the API router under the /api path app.use('/api', apiRouter); -// --- Gallery backend proxy (/photos and /uploads → gallery-backend container) --- -const http = require('http'); -const GALLERY_HOST = process.env.GALLERY_BACKEND_HOST || 'gallery-backend'; -const GALLERY_PORT = parseInt(process.env.GALLERY_BACKEND_PORT || '5000'); - -function proxyToGallery(req, res) { - const proxy = http.request({ - hostname: GALLERY_HOST, - port: GALLERY_PORT, - path: req.originalUrl, - method: req.method, - headers: { ...req.headers, host: GALLERY_HOST }, - }, (proxyRes) => { - res.writeHead(proxyRes.statusCode, proxyRes.headers); - proxyRes.pipe(res); - }); - proxy.on('error', () => { if (!res.headersSent) res.status(502).end(); }); - req.pipe(proxy); -} - -app.use('/photos', proxyToGallery); -app.use('/uploads', proxyToGallery); - // --- Static Files --- const staticCacheOptions = { maxAge: process.env.NODE_ENV === 'production' ? '30d' : 0,