referer-restriction
IMPORTANT
Only one of whitelist
or blacklist
attribute must be specified. They cannot work together.
Once you have configured the Plugin as shown above, you can test it by setting Referer: http://xx.com/x
:
curl http://127.0.0.1:9080/index.html -H 'Referer: http://yy.com/x'
Since we have set bypass_missing
to true
a request without the Referer
header will be successful as the check is skipped:
curl http://127.0.0.1:9080/index.html
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
"uri": "/index.html",
"plugins": {},
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}