Nginx配置中,可以判断URL中是否带特定的变量。

比如,如果URL中不带变量名为Signature的变量,即这个URL不包含signed URL的认证信息,返回403.

Nginx配置中,可以用$arg_xxx来判断变量名为xxx的变量。

具体配置如下:

server {
  listen       80;
  server_name ~^(.+)$;
  gzip on;
  gzip_proxied any;
  location / {
      if ($arg_Signature) {
      proxy_pass http://xxxx;
      access_log /var/log/nginx/upstream.log;
      add_header Cache-Control "public, max-age=604800";
      break;
    }
    return 403;
  }
}

 

相关文章:

  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2021-12-18
  • 2022-02-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-28
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-06-22
相关资源
相似解决方案