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

   ### Current Behavior
   
   If you configure Nginx to listen on a unix socket:
   ```yaml
   nginx_config:
     http_server_configuration_snippet: |
       listen unix:/run/sockets/apisix_http;
   ```
   And then make a request that is handled by the batch-requests plugin, you 
get the following error:
   ```
   connect to apisix failed: missing the port number
   ```
   
   This is because the batch-requests plugin uses the `ngx.var.server_port` 
variable when setting up the internal request, assuming that it is populated 
with a port number.  If the client connection came over a unix listening 
socket, `ngx.var.server_port` is a zero length string.
   
   ### Expected Behavior
   
   I get that unix sockets are probably an edge case but it would be nice if 
this worked.
   
   I will submit a PR shortly with my modified `batch-requests.lua` that checks 
for this condition and then gets the `server_port` from the `node_listen` 
property of the APISIX configuration.
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   * Use the latest docker image
   * Configure nginx (via apisix config.yml) to listen on a unix socket:
   ```yaml
   nginx_config:
     http_server_configuration_snippet: |
       listen unix:/run/sockets/apisix_http;
   ```
   * Configure the batch-requests plugin
   * Issue a batch-request via the unix socket:
   `curl --unix-socket /run/sockets/apisix_http http://127.0.0.1:9080/your_url 
--data '{}'`
   
   ### Environment
   
   - APISIX version: 3.11.0
   - Operating system: 
   - OpenResty / Nginx version: openresty/1.25.3.2
   - etcd version: Using Standalone mode
   - APISIX Dashboard version, if relevant: Dashboard not in use
   - Plugin runner version, for issues related to plugin runners: N/A
   - LuaRocks version, for installation issues (run `luarocks --version`): N/A
   


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