0

所以我已经安装了我的重写插件,但是当我尝试将它添加到我的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

我使用了官方文档中的这个例子,但它似乎不起作用。有任何想法吗?

4

1 回答 1

0

您应该对齐连字符和键:

  - rewrite:
  - condition:
      name: pathmatch
      match: /*
    action:
      rewrite: /catering/*
      redirect: 302
于 2020-06-17T04:46:46.783 回答