Score:0

Why am I getting invalid parameter for a variable I defined in map?

ye flag

I'm trying to define whitelisting for certain domain names on my server. I've figured out a way to do this using the map context but now I'm getting an invalid parameter "$whitelist" for a variable that I have defined in the map context. I already tried this method before, and it's worked, but now I'm suddenly getting an error. I'm not sure why that's the case though.

map $http_host $whitelist {
  default 0;
  "~^(?<subdomain>\w+)\.(?<domain>domain-name\.example\.com)$" $domain;

  # whitelist domains
  whitelist1 example.com;
  whitelist2 subdomain.example.com;
}

server {
  listen 80;
  resolver 127.0.0.11 ipv6=off;
  proxy_intercept_errors on;


  # error_page 400 403 = @fallback;
  if ($whitelist = 0) {
    return 403;
  }

  location /v1/ {

    allow $whitelist;
    deny all;
  }

  location @fallback {
    return 400;
}

Score:0
us flag

allow directive accepts only IP addresses, CIDR ranges, unix: or all as argument, as documented in directive documentation.

In your configuration the entries are domain names, which are not supported.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.