title: nginx regex in location with proxy_pass
body: <p>I am attempting to set up a simple reverse proxy. I want requests for <a href="http://proxy.myserver.com/X/Y/something/somethingelse" rel="nofollow">http://proxy.myserver.com/X/Y/something/somethingelse</a> to proxy to <a href="http://videoX.sY.server.local/something/somethingelse" rel="nofollow">http://videoX.sY.server.local/something/somethingelse</a>.</p>
  
  <p>Using the config below I only receive 404's from nginx.</p>
  
  <p>Is this possible? and if so what am I doing wrong?</p>
  
  <p>nginx.conf:</p>
  
  <pre><code>user www-data;
  worker_processes 1;
  pid /var/run/nginx.pid;
  error_log /var/log/nginx/error.log;
  
  events {
      worker_connections 768;
      # multi_accept on;
  }
  
  http {
  
      ##
      # Logging Settings
      ##
  
      access_log /var/log/nginx/access.log;
      error_log /var/log/nginx/error.log;
  
      include /etc/nginx/conf.d/*.conf;
  }
  </code></pre>
  
  <p>proxy1.conf:</p>
  
  <pre><code>server {
    listen 80;
    server_name proxy.myserver.com;
  
    more_set_headers 'Access-Control-Allow-Origin: *';
    more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE';
    more_set_headers 'Access-Control-Allow-Credentials: true';
    more_set_headers 'Access-Control-Allow-Headers: Origin,Content-Type,Accept';
  
    location /(\d+)/(\d+)/ {
      if ($request_method = OPTIONS ) {
        add_header Content-Length 0;
        add_header Content-Type text/plain;
        return 204;
      }
  
      proxy_pass                  http://video$1.s$2.server.local;
      proxy_redirect              off;
      proxy_connect_timeout       90;
      proxy_send_timeout          90;
      proxy_read_timeout          90;
      client_max_body_size        10m;
      proxy_buffer_size           4k;
      proxy_buffers               4 32k;
      proxy_busy_buffers_size     64k;
    }
  
  }
  </code></pre>
  
  <p>Thanks</p>