Kozatoo opened a new issue, #10505:
URL: https://github.com/apache/apisix/issues/10505

   ### 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to