title: Why do I get 404 on nginx reverse proxy?
body: <p>Below is my config and I'm getting 404 on all routes defined apart from the <code>well-known</code> route and I don't understand why.</p>
  
  <p>If I make a request to <a href="http://example.tech/connect" rel="nofollow noreferrer">http://example.tech/connect</a> I get a 404 and if I make a request to <a href="http://api.example.tech" rel="nofollow noreferrer">http://api.example.tech</a> I also get a 404.  </p>
  
  <p>I can't see where I've gone wrong as this looks like it should work!</p>
  
  <pre><code>user  nginx;
  worker_processes  auto;
  
  error_log  /var/log/nginx/error.log warn;
  pid        /var/run/nginx.pid;
  
  
  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"';
  
      access_log  /var/log/nginx/access.log  main;
      error_log  /var/log/nginx/error.log  warn;
  
      sendfile        on;
      #tcp_nopush     on;
  
      keepalive_timeout  65;
  
      #gzip  on;
  
      #REMOVE REFERENCE TO FILES THAT HAVE  "server" and "location" blocks in them so we can do it all in this file
      #include /etc/nginx/conf.d/*.conf;
  
      # issue with ip and the nginx proxy
      real_ip_header X-Forwarded-For;
      set_real_ip_from 0.0.0.0/0;
  
      server {
          listen 80;
          listen [::]:80;
          server_name example.tech;
  
          location /.well-known/openid-configuration {
              proxy_pass https://myapp.net;
  
              proxy_redirect off;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection keep-alive;
              #proxy_set_header Host $host;
              proxy_cache_bypass $http_upgrade;
              proxy_set_header X-Forwarded-Host $host;
              #proxy_set_header X-Forwarded-Proto $scheme;
              client_max_body_size 10m;
              client_body_buffer_size 128k;
              proxy_connect_timeout 90;
              proxy_send_timeout 90;
              proxy_read_timeout 90;
              proxy_buffers 32 4k;
          }
  
          location /connect {
              proxy_pass https://myapp.net;
  
              proxy_redirect off;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection keep-alive;
              #proxy_set_header Host $host;
              proxy_cache_bypass $http_upgrade;
              proxy_set_header X-Forwarded-Host $host;
              #proxy_set_header X-Forwarded-Proto $scheme;
              client_max_body_size 10m;
              client_body_buffer_size 128k;
              proxy_connect_timeout 90;
              proxy_send_timeout 90;
              proxy_read_timeout 90;
              proxy_buffers 32 4k;
          }
  
          location /auth {
              proxy_pass https://myapp.net;
  
              proxy_redirect off;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection keep-alive;
              #proxy_set_header Host $host;
              proxy_cache_bypass $http_upgrade;
              proxy_set_header X-Forwarded-Host $host;
              #proxy_set_header X-Forwarded-Proto $scheme;
              client_max_body_size 10m;
              client_body_buffer_size 128k;
              proxy_connect_timeout 90;
              proxy_send_timeout 90;
              proxy_read_timeout 90;
              proxy_buffers 32 4k;
          }
      }
  
      server {
          listen 80;
          listen [::]:80;
          server_name api.example.tech;
  
          location /auth/ {
              proxy_pass https://myapp.net;
  
              proxy_redirect off;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection keep-alive;
              #proxy_set_header Host $host;
              proxy_cache_bypass $http_upgrade;
              proxy_set_header X-Forwarded-Host $host;
              #proxy_set_header X-Forwarded-Proto $scheme;
              client_max_body_size 10m;
              client_body_buffer_size 128k;
              proxy_connect_timeout 90;
              proxy_send_timeout 90;
              proxy_read_timeout 90;
              proxy_buffers 32 4k;
          }
      }
  }
  </code></pre>