server {

  listen 1.1.1.1:443 ssl http2;

  server_name foobar.de ;

satisfy all;
allow 2.2.2.2/32;
deny all;



  ssl on;

  location / {

    error_page 418 = @optout;
    if ( $query_string ~* "module=CoreAdminHome&action=optOut" ) { return 418; }
    proxy_pass  http://foobar;
    error_page 502 503 504 =503 @fallback;
  }

  location @optout {
    allow all;

    proxy_pass  http://foobar;
  }
  location ^~ /piwik.php {
    allow all;

    proxy_pass  http://foobar;
  }
  location ^~ /piwik.js {
    allow all;
    proxy_pass  http://foobar;

  }

  location @fallback {
    proxy_pass http://127.0.0.1:81;
  }
}