ip-restriction插件可以在网关层进行客户端请求ip拦截。
当然了,一般不推荐使用该方法,专业的事专业工具做。建议有条件,还是上防火墙或者waf来做。
官方文档:ip-restriction | Apache APISIX® -- Cloud-Native API Gateway



whitelist:白名单,配置允许访问的ip。
blacklist:黑名单,配置禁止访问的ip。
估计有朋友要问了,我上面那个external_auth的配置节干什么用的。
这个由于业务需要,我们做了一个动态校验请求。就是拦截后会请求这个链接,软如参数,然后如果返回200,就自动放通,如果返回其他状态,就拦截。
这个是自己写脚本实现的。代码如下,其实就是改了ip-restriction的脚本,增加了一个参数。
---
apiVersion: v1
data:
init.lua: |
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.


517

被折叠的 条评论
为什么被折叠?



