所以我已经安装了重写插件,但是当我尝试将它添加到我的gateway.config.yml文件中时,我得到了这个错误:Error: data.policies[8] should be string at Config.loadConfig (/home/lovro/SI_ExamProject/gateway/node_modules/express-gateway/lib/config/config.js:55:13) at forEach.type (/home/lovro/SI_ExamProject/gateway/node_modules/express-gateway/lib/config/index.js:12:48) at Array.forEach (<anonymous>) at Object.<anonymous> (/home/lovro/SI_ExamProject/gateway/node_modules/express-gateway/lib/config/index.js:12:25) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17)
这是我的policies的样子:
policies: - basic-auth - cors - expression - key-auth - log - oauth2 - proxy - rate-limit - rewrite: - condition: name: pathmatch match: /* action: rewrite: /catering/* redirect: 302
我使用了官方文档中的这个例子,但它似乎不起作用。有什么想法吗?
发布于 2020-06-17 12:46:47
您应该将连字符和键对齐:
- rewrite:
- condition:
name: pathmatch
match: /*
action:
rewrite: /catering/*
redirect: 302https://stackoverflow.com/questions/59192297
复制相似问题