<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Folks,<div><br></div><div>1. I have tried to use the map+subfilter as the below snip.</div><div><br></div><div><pre class="gmail-wiki" style="background:rgb(247,247,247);border:1px solid rgb(215,215,215);border-radius:0.3em;margin:1em 1.75em;padding:0.25em;overflow:auto;color:rgb(0,0,0);font-size:13px">user nginx;
worker_processes auto;

daemon off;

events {
  worker_connections  1024;
}

http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;

  log_format  main '$remote_addr - $remote_user [$time_local] "$request" '
                   '$status $body_bytes_sent "$http_referer" '
                   '"$http_user_agent" "$http_x_forwarded_for" '
                   '(Cache $upstream_cache_status)';

  access_log /dev/stdout main;

  sendfile on;
  keepalive_timeout 65;
  gzip on;

  # Due to we are listening only http, therefore be sure to always return http://
  map $request_uri $subfilter_allowed_content_type {
    volatile;
    default                         whatever/donothing;
    ~/artifactory/api/nuget/.*      application/atom+xml;
  }

  proxy_cache_path /var/cache/nginx/artifactory
                   levels=1:2
                   keys_zone=artifactory_cache:50m
                   max_size=50g
                   inactive=24h
                   use_temp_path=off;

  server {
    listen 80;
    server_name ~(?<repo>.+)\.artifactory.tapioca.lan;

    resolver 8.8.8.8;

    set $upstream <a href="https://artifactory.myaws.com/artifactory">https://artifactory.myaws.com/artifactory</a>;

    location /artifactory/ {
      sub_filter_types $subfilter_allowed_content_type;   # the variable is filled up correctly
      #sub_filter_types "application/atom+xml";           # but, when use it hardcode. then it works fine.

      sub_filter_last_modified on;
      sub_filter "https://$host" http://$host";           # it works only when use sub_filter_types with hardcore value.
      sub_filter_once off;

      # its been filled correctly
      add_header X-Debug-subfilter-allowed-content-type "$subfilter_allowed_content_type";

      proxy_read_timeout  60s;
      proxy_pass_header   Server;
      proxy_cookie_path   ~*^/.* /;

      if ( $request_uri ~ ^/artifactory/(.*)$ ) {
        proxy_pass        $upstream/$1;
      }

      proxy_pass          $upstream;

      proxy_set_header    Host              $http_host;
      proxy_set_header    X-Forwarded-Port  $server_port;
      proxy_set_header    X-Forwarded-Proto $http_x_forwarded_proto;
      proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;
      proxy_set_header    X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
      proxy_set_header    X-JFrog-Art-Api   $artifactory_token;
    }
  }
}</pre><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><br></div><div>2. I do the request like.<br></div><div><br></div><div>curl -s -H "Host: artifactory-proxy.mylan.fni" " <a href="http://172.17.0.2/artifactory/api/nuget/v3/dtfni-nuget/Packages(Id='AttributeRouting.Core.Web">http://172.17.0.2/artifactory/api/nuget/v3/dtfni-nuget/Packages(Id='AttributeRouting.Core.Web</a>',Version='3.5.6')"<br></div><div><br></div><div>Conclusion: the variable it been filled up correctly, but the sub_filter_types looks to not process. Someone has any suggestion?<br></div><div><br></div><div>ps: I am using the nginx 1.12.x</div><div><br></div><div><br></div><div dir="ltr">--<div>Jorge Pereira</div></div></div></div></div></div></div></div></div></div>