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

   ### Current State
   
   Following the description the test request is forewarded to example.com 
instead of httpbin.org.
   Problem occured with version 3.1 apisix docker on windows 11 running with 
docker-desktop.
   
   Missing "anything" was already addressed 
(https://github.com/apache/apisix/issues/8729), this is about missing config 
attribute for proper working example.
   
   ### Desired State
   
   Described behavior and code samples should match.
   For routing to httpbin.org the attribute `"pass_host": "node"`  must be set 
in upstream configuration, otherwise the host (httpbin.org) configured in 
upstream is not used.
   
   So it should be:
   
   ### 1. Create an Upstream.
   Create an Upstream service containing httpbin.org that you can use for 
testing. This is a return service that will return the parameters we passed in 
the request.
   
   ```
   curl "http://127.0.0.1:9180/apisix/admin/upstreams/1"; \
   -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
   {
     "type": "roundrobin",
     "pass_host": "node",
     "nodes": {
       "httpbin.org:80": 1
     }
   }'
   ```
   
   ...
   
   Adding an upstream object to your route can achieve the above effect.
   ```
   curl "http://127.0.0.1:9180/apisix/admin/routes/1"; \
   -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
   {
     "methods": ["GET"],
     "host": "example.com",
     "uri": "/anything/*",
     "upstream": {
       "type": "roundrobin",
       "pass_host": "node",
       "nodes": {
         "httpbin.org:80": 1
       }
     }
   }
   ```
   
   
   Additional personal opinion: in this example I find `"host": "example.com"` 
in route config and curl parameter `-H "Host: example.com"` a bit confusing, 
especially because it did not work without proper "pass_host" attribute. 
However, I think it does not help to demonstrate the case.


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