我有一个Nginx设置,其中包括一个包含白名单IP的文件,该文件可以访问我的站点的管理门户admin.site.com
。通常,如果响应为403或404,即如果其IP不在白名单中,则所有用户都将重定向到site.com
。这就是我所拥有的
server {
# listen on port 80 (http)
listen 80;
server_name admin.site.com;
location ~ /.well-known/acme-challenge {
allow all;
root /var/www/.well-known/acme-challenge/;
default_type "text/plain";
try_files $uri =404;
}
location / {
# redirect any requests to the same URL but on https
return 301 https://$host$request_uri;
}
}
server {
# listen on port 443 (https)
listen 443 http2 ssl;
server_name admin.site.com;
root /var/www/admin.site.com/site-frontend/;
index index.html;
location / {
include /etc/nginx/snippets/whitelist.conf;
error_page 403 404 =301 site.com;
}
# location of SSL certificate
ssl_certificate /etc/some/path/admin.site.com/fullchain.pem;
ssl_certificate_key /etc/some/path/admin.site.com/privkey.pem;
...
...
...
如何允许未经过滤的流量流向某些端点,例如site.com/api/no-filters
代表所有流量?