leslie-tsang commented on issue #6209:
URL: https://github.com/apache/apisix/issues/6209#issuecomment-1021937519


   > @leslie-tsang Please look the demo again, I think it not relate with the 
upstream, I think any request with uri /test/index.html will be forward to 
http://iresty.com/test/home/html, because the proxy-rewrite plugin rewrite the 
request right ?
   
   I afraid the answer is no. 
   The request will be send to `http://127.0.0.1:80/test/index.html` with the 
request header `host: iresty.com`
   > The `502` error occur as there is no service listen to `127.0.0.1:80`
   
   You can try the following `CMD` to test if it achieves your goal
   ```bash
   curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "methods": ["GET"],
       "uri": "/test/index.html",
       "plugins": {
           "proxy-rewrite": {
               "uri": "/test/home.html",
               "scheme": "http",
               "host": "iresty.com",
               "headers": {
                   "X-Api-Version": "v1",
                   "X-Api-Engine": "apisix",
                   "X-Api-useless": ""
               }
           }
       },
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "iresty.com:80": 1
           }
       }
   }'
   ```
   
   


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