← back to Dw Internal Gateway
gateway: alias lilycolor.internal.dw → japan-viewer pre-filtered (src_label=Lilycolor)
5ac5875652f23914ecbc9f1dfdf9cde746673378 · 2026-07-23 15:33:19 -0700 · Steve Abrams
lilycolor_catalog is empty; its 2,543 records + images live only in the shared
japan-viewer (zip-packed local swatches served by that app's SKU resolver, no
servable URL for a generic catalog view). Rather than populate an imageless
lilycolor_catalog, 302 the alias to japan.internal.dw filtered to its Lilycolor
Source facet. Config-driven via routes.json redirects{}.
Files touched
Diff
commit 5ac5875652f23914ecbc9f1dfdf9cde746673378
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Jul 23 15:33:19 2026 -0700
gateway: alias lilycolor.internal.dw → japan-viewer pre-filtered (src_label=Lilycolor)
lilycolor_catalog is empty; its 2,543 records + images live only in the shared
japan-viewer (zip-packed local swatches served by that app's SKU resolver, no
servable URL for a generic catalog view). Rather than populate an imageless
lilycolor_catalog, 302 the alias to japan.internal.dw filtered to its Lilycolor
Source facet. Config-driven via routes.json redirects{}.
---
routes.json | 4 ++++
server.js | 18 +++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/routes.json b/routes.json
index 8c459ba..0ff1883 100644
--- a/routes.json
+++ b/routes.json
@@ -13,5 +13,9 @@
"whimsical": 9787,
"pattern-vault": 9779,
"domains": 9784
+ },
+ "redirectsComment": "Aliases that 302 to another internal host, optionally pre-filtered. Used when a line's data already lives (with images) inside a shared multi-brand viewer, so a standalone <slug>_catalog copy would be a redundant, imageless duplicate. lilycolor images are zip-packed local files served only by the japan-viewer's SKU resolver, so we alias to it filtered by its Source facet (src_label=Lilycolor) instead of populating an imageless lilycolor_catalog.",
+ "redirects": {
+ "lilycolor": "japan.internal.dw/?src_label=Lilycolor"
}
}
diff --git a/server.js b/server.js
index 62b3bcf..6935b00 100644
--- a/server.js
+++ b/server.js
@@ -15,7 +15,12 @@ const { Pool } = require('pg');
const PORT = Number(process.env.PORT || 80);
const BIND = process.env.IGW_BIND || '127.0.0.1'; // loopback-only; ambient $BIND must not flip this public
const AUTH = 'Basic ' + Buffer.from('admin:DW2024!').toString('base64');
-const ROUTES = JSON.parse(fs.readFileSync(path.join(__dirname, 'routes.json'), 'utf8')).routes;
+const CFG = JSON.parse(fs.readFileSync(path.join(__dirname, 'routes.json'), 'utf8'));
+const ROUTES = CFG.routes;
+// slug -> "targethost.internal.dw/?query" alias. 302's to another internal host,
+// optionally pre-filtered, so a line whose data already lives (with images) in a
+// shared viewer isn't duplicated into an imageless generic <slug>_catalog view.
+const REDIRECTS = CFG.redirects || {};
const pool = new Pool({ host: '/tmp', database: 'dw_unified', max: 5 });
@@ -366,6 +371,17 @@ const server = http.createServer(async (req, res) => {
return res.end(await indexPage());
}
+ // 0. Alias slugs → 302 to another internal host (same gateway port), pre-filtered.
+ // e.g. lilycolor → japan.internal.dw/?src_label=Lilycolor (its data + images live
+ // in the shared japan-viewer; a standalone lilycolor_catalog would be imageless).
+ if (REDIRECTS[slug]) {
+ const [thost, tquery = ''] = REDIRECTS[slug].split('/?');
+ const portSuffix = PORT === 80 ? '' : ':' + PORT;
+ const location = '//' + thost + portSuffix + '/' + (tquery ? '?' + tquery : '');
+ res.writeHead(302, { Location: location });
+ return res.end();
+ }
+
// 1. Bespoke dedicated viewers (luxury microsite lines etc.) keep their own app.
if (ROUTES[slug]) return proxy(req, res, ROUTES[slug]);
← e9fe407 every vendor follows all.dw schema: vendor-locked proxy to l
·
back to Dw Internal Gateway
·
gateway: prefer staging catalog over tiny live-shopify view 9940353 →