apache/apisix

help request: Failed to parse domain

Open

#10,505 创建于 2023年11月16日

在 GitHub 查看
 (20 评论) (0 反应) (1 负责人)Lua (16,597 star) (2,860 fork)batch import
help wanted

描述

Description

Context: I'm trying to build an application with an Auth Service which should only validate the tokens, and admin service which sould be protected.

I am running APIsix from docker container, but I keep getting errors about failing to parse the domain. When runing echo $variable_name inside the container, it echoes perfectly. But I still get these errors inside the log file.

The calls to the Auth service to check for the API are actually working, and the call to Admin service as well. But I still get these errors in the logs

On another hand, when effectuating these API calls from a front-end application, I get a CORS error, and I noted that the authorization header is not present inside the request sent with forward-auth plugin (even though I've added it inside the request_headers)

Here are the logs


2023/11/16 11:08:54 [error] 55#55: *160063 [lua] resolver.lua:80: parse_domain(): failed to parse domain: ${{AUTH_SERVICE_IP:=}}:${{AUTH_SERVICE_PORT:=3000}}, error: failed to query the DNSserver: dns server error: 3 name error, client: 172.21.0.1, server: _, request: "OPTIONS /auth/greet HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:4200/"
2023/11/16 11:08:54 [error] 55#55: *160063 [lua] upstream.lua:79: parse_domain_for_nodes(): dns resolver domain: ${{AUTH_SERVICE_IP:=}}:${{AUTH_SERVICE_PORT:=3000}} error: failed to query the DNS server: dns server error: 3 name error, client: 172.21.0.1, server: _, request: "OPTIONS /auth/greet HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:4200/"
2023/11/16 11:08:54 [error] 55#55: *160063 [lua] resolver.lua:80: parse_domain(): failed to parse domain: ${{AUTH_SERVICE_IP:=}}:${{AUTH_SERVICE_PORT:=3000}}, error: failed to query the DNSserver: dns server error: 3 name error, client: 172.21.0.1, server: _, request: "GET /auth/greet HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:4200/"
2023/11/16 11:08:54 [error] 55#55: *160063 [lua] upstream.lua:79: parse_domain_for_nodes(): dns resolver domain: ${{AUTH_SERVICE_IP:=}}:${{AUTH_SERVICE_PORT:=3000}} error: failed to query the DNS server: dns server error: 3 name error, client: 172.21.0.1, server: _, request: "GET /auth/greet HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:4200/"
2023/11/16 11:08:55 [warn] 55#55: *160063 [lua] plugin.lua:1107: run_plugin(): forward-auth exits with http status code 401, client: 172.21.0.1, server: _, request: "OPTIONS /admin/users HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:4200/"

apisix.yaml


routes:
  - uri: /auth/*
    plugins:
      proxy-rewrite:
        regex_uri: ["^/auth/(.*)","/$1"]

    upstream:
      nodes:
        "${{AUTH_SERVICE_IP:=}}:${{AUTH_SERVICE_PORT:=3000}}": 1
      type: roundrobin
    
  - uri: /admin/*
    plugins:  
      proxy-rewrite:
        regex_uri: ["^/admin/(.*)","/$1"]
      forward-auth:
        uri: http://${{AUTH_SERVICE_IP:=}}:${{AUTH_SERVICE_PORT:=3000}}/validate
        ssl_verify: false
        request_headers: ["Authorization",authorization]
    upstream:
      nodes:
        "${{ADMIN_SERVICE_IP:=192.168.1.76}}:${{ADMIN_SERVICE_PORT:=3001}}": 1
    
#END

Environment

APISIX: 3.6 dockerized etcd:3.4.15 dockerized

贡献者指南

help request: Failed to parse domain · apache/apisix#10505 | Good First Issue