title: Cannot use YouTrack with nginx on a subdomain
body: <p>I am trying to run YouTrack as a subdomain via nginx. But YouTrack does not work.</p>
  <p>I am using YouTrack 2018.1.41826, since the update to YouTrack 2019 did not work (no login possible after update, but this is a separate issue), nginx 1.18.0, Java 8u265-b01 for YouTrack and (AdoptOpenJDK-)Java 11.0.8+10 for nginx and for tomcat (see below). I start YouTrack on port 8081 via</p>
  <p><code>java -Xmx2048m -jar youtrack-2018.1.41826.jar localhost:8081 &amp;</code></p>
  <p>Inside YouTrack, the base URL is configured to be <code>https://&lt;my domain&gt;/youtrack</code>, <code>&lt;my domain&gt;</code> being my domain name. On port 8080, a tomcat server is running with different applications. So I configured nginx as follows (replace <code>&lt;my domain&gt;</code>):</p>
  <pre><code>    http {
          include       mime.types;
          default_type  application/octet-stream;
  
          client_max_body_size 12m;
          client_body_buffer_size 16k;
  
          sendfile        on;
  
          keepalive_timeout  65;
  
          location / {
  
              proxy_set_header        Host $host;
              proxy_set_header        X-Real-IP $remote_addr;
              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header        X-Forwarded-Proto $scheme;
  
              proxy_pass          http://localhost:8080;
              proxy_read_timeout  90;
  
              proxy_redirect      http://localhost:8080 https://&lt;my domain&gt;;
          }
  
          location ~ ^/youtrack/(.*)$ {
  
              proxy_set_header X-Forwarded-Host $http_host;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
  
              proxy_buffers 8 64k;
              proxy_busy_buffers_size 128k;
              proxy_buffer_size 64k;
  
              client_max_body_size 10m;
  
              proxy_http_version 1.1;
              proxy_pass http://127.0.0.1:8081/$1;
  
              proxy_redirect      http://127.0.0.1:8081 https://&lt;my domain&gt;/youtrack;
          }
  
          location ~ ^/youtrack/api/eventSourceBus/(.*)$ {
              proxy_cache off;
              proxy_buffering off;
              proxy_read_timeout 86400s;
              proxy_send_timeout 86400s;
              proxy_set_header Connection '';
              chunked_transfer_encoding off;
  
              proxy_set_header X-Forwarded-Host $http_host;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
              proxy_http_version 1.1;
              proxy_pass http://127.0.0.1:8081/api/eventSourceBus/$1;
  
              proxy_redirect      http://127.0.0.1:8081 https://&lt;my domain&gt;/youtrack;
          }
  
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   html;
          }
  
      }
  </code></pre>
  <p>Now, when opening https:///youtrack/ in the web browser, the URL changes to <code>https://&lt;my domain&gt;/oauth?state=%2F</code>, forgetting about the <code>youtrack</code> subdomain. How should I fix this?</p>