如何将HTTP请求发送到APISIX Gateway中的外部服务无服务器-Pre-Function,我在下面尝试,但收到错误
"serverless-pre-function": {
"disable": false,
"functions": [
"return function() ngx.location.capture("http://host.docker.internal:9191/health"); ngx.log(ngx.ERR, "serverless pre function"); end"
],
"phase": "before_proxy"
}
2022/09/13 14:50:20 [error] 49#49: *19282359 open() "/usr/local/apisix/htmlhttp://host.docker.internal:9191/health" failed (2: No such file or directory), client: 172.18.0.1, server: _, request: "GET /dbt/actuator/health HTTP/1.1", subrequest: "http://host.docker.internal:9191/health", host: "127.0.0.1:9080"
调用外部服务后,预函数函数将继续执行原始请求。
1条答案
按热度按时间doinxwow1#
我通过使用
resty.http
解决了这个问题,如下所示