How to add other sites in refferer

i am trying to add 2 more site as refferer

location /folder1/ {
add_header Content-disposition "attachment; filename=$1";
         default_type application/octet-stream;

    if ($http_referer !~ "https://site1.com/"){
            return 403;
    }
}

if i try to add site2.com in refferer nginx won’t start

location /folder1/ {
add_header Content-disposition "attachment; filename=$1";
         default_type application/octet-stream;

    if ($http_referer !~ "https://site1.com/.https://site2.com"){
            return 403;
    }
}

also tried this one still no success

location /folder1/ {
add_header Content-disposition "attachment; filename=$1";
 default_type application/octet-stream;

if ($http_referer !~ "https://site1.com/"."https://site2.com"){
    return 403;
}
  }

any solution i mean how to add more site in refferer list

You can just repeat the block multiple times

location /folder1/ {
    add_header Content-disposition "attachment; filename=$1";
    default_type application/octet-stream;

    if ($http_referer !~ "https://site1.com/"){
            return 403;
    }

    if ($http_referer !~ "https://site2.com/"){
            return 403;
    }
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.