kingluo commented on issue #7844:
URL: https://github.com/apache/apisix/issues/7844#issuecomment-1239048182

   @tzssangglass With ipset, it's an easy job.
   
   Example:
   
   ```bash
   # use domain to define the route
   
   curl http://127.0.0.1:9080/apisix/admin/routes/route_via_proxy  -H 
'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/anything",
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "httpbin.org": 1
           }
       }
   }'
   
   # create an ipset
   ipset create myset hash:net
   
   # setup iptables rules
   iptables -t nat -A QQQ -p tcp -m set --match-set myset src -j REDIRECT 
--to-ports 12345
   iptables -t nat -I OUTPUT 1 -j QQQ
   iptables -t nat -I PREROUTING 1 -j QQQ
   ```
   
   Run this script to update ipset periodically:
   
   https://gist.github.com/kingluo/8944c1435c3c93fd7bccaca3f4f810ba
   
   Adjust `hosts` to contain your upstream domains.


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