@quintype/framework 7.5.0 → 7.6.0-ttl.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/impl/api-client-impl.js +2 -2
- package/server/routes.js +12 -3
package/package.json
CHANGED
|
@@ -29,9 +29,9 @@ function createTemporaryClient(config, hostname) {
|
|
|
29
29
|
return new Client(configuredHosts[hostname], true);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const matchedWildcardUrl = (config.wildcard_to_api_host || []).find((str) => hostname.includes(str));
|
|
33
33
|
|
|
34
|
-
if (
|
|
34
|
+
if (matchedWildcardUrl) return new Client(`http://${hostname.replace(matchedWildcardUrl, ".internal")}`, true);
|
|
35
35
|
|
|
36
36
|
const matchedString = (config.host_to_automatic_api_host || []).find((str) => hostname.includes(str));
|
|
37
37
|
|
package/server/routes.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @category Server
|
|
7
7
|
* @module routes
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
const { match } = require("path-to-regexp");
|
|
10
10
|
const { generateServiceWorker } = require("./handlers/generate-service-worker");
|
|
11
11
|
const {
|
|
12
12
|
handleIsomorphicShell,
|
|
@@ -70,7 +70,10 @@ exports.upstreamQuintypeRoutes = function upstreamQuintypeRoutes(
|
|
|
70
70
|
parseInt(_sMaxAge) > 0 &&
|
|
71
71
|
apiProxy.on("proxyRes", function (proxyRes, req) {
|
|
72
72
|
const pathName = get(req, ["originalUrl"], "").split("?")[0];
|
|
73
|
-
const checkForExcludeRoutes = excludeRoutes.
|
|
73
|
+
const checkForExcludeRoutes = excludeRoutes.some((path) => {
|
|
74
|
+
const matchFn = match(path, { decode: decodeURIComponent });
|
|
75
|
+
return matchFn(pathName);
|
|
76
|
+
});
|
|
74
77
|
const getCacheControl = get(proxyRes, ["headers", "cache-control"], "");
|
|
75
78
|
if (!checkForExcludeRoutes && getCacheControl.includes("public")) {
|
|
76
79
|
proxyRes.headers["cache-control"] = getCacheControl.replace(/s-maxage=\d*/g, `s-maxage=${_sMaxAge}`);
|
|
@@ -87,7 +90,13 @@ exports.upstreamQuintypeRoutes = function upstreamQuintypeRoutes(
|
|
|
87
90
|
});
|
|
88
91
|
|
|
89
92
|
// Mention the routes which don't want to override the s-maxage value
|
|
90
|
-
const excludeRoutes = [
|
|
93
|
+
const excludeRoutes = [
|
|
94
|
+
"/qlitics.js",
|
|
95
|
+
"/api/v1/breaking-news",
|
|
96
|
+
"/stories.rss",
|
|
97
|
+
"/api/v1/collections/:slug.rss",
|
|
98
|
+
"/api/v1/advanced-search",
|
|
99
|
+
];
|
|
91
100
|
|
|
92
101
|
app.all("/api/*", sketchesProxy);
|
|
93
102
|
app.all("/login", sketchesProxy);
|