From 1ef7cb14364e0083c9ea0f2b4c2d1f8fdf22e098 Mon Sep 17 00:00:00 2001 From: "Addo.Zhang" Date: Fri, 15 Sep 2023 20:28:52 +0800 Subject: [PATCH] fix wrong field name and hostname process logic (#54) * fix wrong field name * fix host name logic --- pjs/filter/url-rewrite.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pjs/filter/url-rewrite.js b/pjs/filter/url-rewrite.js index 0339d70..640dfe9 100644 --- a/pjs/filter/url-rewrite.js +++ b/pjs/filter/url-rewrite.js @@ -58,6 +58,10 @@ ) )() ) + ) : cfg?.hostname ? ( + head => head.headers && ( + head.headers.host = cfg.hostname + ) ) : null ) ), @@ -65,9 +69,9 @@ makeRewriteHandler = (path, cfg) => ( ( handlers = (cfg?.Filters || []).filter( - e => e?.Type === 'URLRewrite' + e => e?.type === 'URLRewrite' ).map( - e => makeHeadHandler(path, e) + e => makeHeadHandler(path, e.urlRewrite) ).filter( e => e )