<h3 dir="auto">Context</h3>
<p dir="auto">I have a neo4j dashboard (7474) behind a reverse proxy binded on https (443)</p>
<h3 dir="auto">What I get</h3>
<p dir="auto">When trying to access the dashboard from https I get redirected to http</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="curl -ILk 'https://neo4j-redirect-issue/' -H 'Accept: text/html' 
HTTP/1.1 303 See Other
Location: https://neo4j-redirect-issue/browser
Content-Type: text/html
Access-Control-Allow-Origin: *
Server: Jetty(9.0.5.v20130815)

HTTP/1.1 302 Found
Location: http://neo4j-redirect-issue/browser/
Server: Jetty(9.0.5.v20130815)

curl: (7) Failed to connect to neo4j-redirect-issue port 80: Connection refused"><pre class="notranslate">curl -ILk <span class="pl-s"><span class="pl-pds">'</span>https://neo4j-redirect-issue/<span class="pl-pds">'</span></span> -H <span class="pl-s"><span class="pl-pds">'</span>Accept: text/html<span class="pl-pds">'</span></span> 
HTTP/1.1 303 See Other
Location: https://neo4j-redirect-issue/browser
Content-Type: text/html
Access-Control-Allow-Origin: <span class="pl-k">*</span>
Server: Jetty(9.0.5.v20130815)

HTTP/1.1 302 Found
Location: http://neo4j-redirect-issue/browser/
Server: Jetty(9.0.5.v20130815)

curl: (7) Failed to connect to neo4j-redirect-issue port 80: Connection refused</pre></div>
<p dir="auto">Here we see the scheme is kept in the first 303 redirect, but lost in the next 302 (when adding the trailing slash).</p>
<h3 dir="auto">What I expect</h3>
<p dir="auto">I expect the scheme to be kept along all redirects so a call to <code class="notranslate">https://neo4j-redirect-issue/</code> end up to <code class="notranslate">https://neo4j-redirect-issue/browser/</code></p>
<p dir="auto">Webadmin interface doesn't use the <code class="notranslate">X-Forwarded-Host</code> and <code class="notranslate">X-Forwarded-Proto</code> headers to generate URLs. The URLs are correctly generated in the REST interface.</p>
<h3 dir="auto">With 1.9.4</h3>
<p dir="auto">A basic query</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ curl -i -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/db/data/
HTTP/1.1 200 OK
Content-Length: 876
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

{
  &quot;extensions&quot; : {
    &quot;CypherPlugin&quot; : {
      &quot;execute_query&quot; : &quot;https://external.foo.bar:1234/db/data/ext/CypherPlugin/graphdb/execute_query&quot;
    },
    &quot;GremlinPlugin&quot; : {
      &quot;execute_script&quot; : &quot;https://external.foo.bar:1234/db/data/ext/GremlinPlugin/graphdb/execute_script&quot;
    }
  },
  &quot;node&quot; : &quot;https://external.foo.bar:1234/db/data/node&quot;,
  &quot;reference_node&quot; : &quot;https://external.foo.bar:1234/db/data/node/0&quot;,
  &quot;node_index&quot; : &quot;https://external.foo.bar:1234/db/data/index/node&quot;,
  &quot;relationship_index&quot; : &quot;https://external.foo.bar:1234/db/data/index/relationship&quot;,
  &quot;extensions_info&quot; : &quot;https://external.foo.bar:1234/db/data/ext&quot;,
  &quot;relationship_types&quot; : &quot;https://external.foo.bar:1234/db/data/relationship/types&quot;,
  &quot;batch&quot; : &quot;https://external.foo.bar:1234/db/data/batch&quot;,
  &quot;cypher&quot; : &quot;https://external.foo.bar:1234/db/data/cypher&quot;,
  &quot;neo4j_version&quot; : &quot;1.9.4&quot;
}"><pre class="notranslate"><code class="notranslate">$ curl -i -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/db/data/
HTTP/1.1 200 OK
Content-Length: 876
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

{
  "extensions" : {
    "CypherPlugin" : {
      "execute_query" : "https://external.foo.bar:1234/db/data/ext/CypherPlugin/graphdb/execute_query"
    },
    "GremlinPlugin" : {
      "execute_script" : "https://external.foo.bar:1234/db/data/ext/GremlinPlugin/graphdb/execute_script"
    }
  },
  "node" : "https://external.foo.bar:1234/db/data/node",
  "reference_node" : "https://external.foo.bar:1234/db/data/node/0",
  "node_index" : "https://external.foo.bar:1234/db/data/index/node",
  "relationship_index" : "https://external.foo.bar:1234/db/data/index/relationship",
  "extensions_info" : "https://external.foo.bar:1234/db/data/ext",
  "relationship_types" : "https://external.foo.bar:1234/db/data/relationship/types",
  "batch" : "https://external.foo.bar:1234/db/data/batch",
  "cypher" : "https://external.foo.bar:1234/db/data/cypher",
  "neo4j_version" : "1.9.4"
}
</code></pre></div>
<p dir="auto">A request simulating a browser</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/db/data/
HTTP/1.1 200 OK
Content-Length: 1195
Content-Type: text/html; charset=UTF-8
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;title&gt;Root&lt;/title&gt;&lt;meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot;&gt;
&lt;link href='http://resthtml.neo4j.org/style/rest.css' rel='stylesheet' type='text/css'&gt;
&lt;script type='text/javascript' src='/webadmin/htmlbrowse.js'&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body onload='javascript:neo4jHtmlBrowse.start();' id='root'&gt;
&lt;div id='content'&gt;&lt;div id='header'&gt;&lt;h1&gt;&lt;a title='Neo4j REST interface' href='/'&gt;&lt;span&gt;Neo4j REST interface&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;&lt;/div&gt;
&lt;div id='page-body'&gt;
&lt;table class=&quot;root&quot;&gt;&lt;caption&gt;Root&lt;/caption&gt;
&lt;tr class='odd'&gt;&lt;th&gt;relationship_index&lt;/th&gt;&lt;td&gt;&lt;a href=&quot;https://external.foo.bar:1234/db/data/index/relationship&quot;&gt;https://external.foo.bar:1234/db/data/index/relationship&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;node_index&lt;/th&gt;&lt;td&gt;&lt;a href=&quot;https://external.foo.bar:1234/db/data/index/node&quot;&gt;https://external.foo.bar:1234/db/data/index/node&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='odd'&gt;&lt;th&gt;reference_node&lt;/th&gt;&lt;td&gt;&lt;a href=&quot;https://external.foo.bar:1234/db/data/node/0&quot; class=&quot;node&quot;&gt;https://external.foo.bar:1234/db/data/node/0&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;div class='break'&gt;&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;"><pre class="notranslate"><code class="notranslate">$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/db/data/
HTTP/1.1 200 OK
Content-Length: 1195
Content-Type: text/html; charset=UTF-8
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;&lt;head&gt;&lt;title&gt;Root&lt;/title&gt;&lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type"&gt;
&lt;link href='http://resthtml.neo4j.org/style/rest.css' rel='stylesheet' type='text/css'&gt;
&lt;script type='text/javascript' src='/webadmin/htmlbrowse.js'&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body onload='javascript:neo4jHtmlBrowse.start();' id='root'&gt;
&lt;div id='content'&gt;&lt;div id='header'&gt;&lt;h1&gt;&lt;a title='Neo4j REST interface' href='/'&gt;&lt;span&gt;Neo4j REST interface&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;&lt;/div&gt;
&lt;div id='page-body'&gt;
&lt;table class="root"&gt;&lt;caption&gt;Root&lt;/caption&gt;
&lt;tr class='odd'&gt;&lt;th&gt;relationship_index&lt;/th&gt;&lt;td&gt;&lt;a href="https://external.foo.bar:1234/db/data/index/relationship"&gt;https://external.foo.bar:1234/db/data/index/relationship&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;node_index&lt;/th&gt;&lt;td&gt;&lt;a href="https://external.foo.bar:1234/db/data/index/node"&gt;https://external.foo.bar:1234/db/data/index/node&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='odd'&gt;&lt;th&gt;reference_node&lt;/th&gt;&lt;td&gt;&lt;a href="https://external.foo.bar:1234/db/data/node/0" class="node"&gt;https://external.foo.bar:1234/db/data/node/0&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;div class='break'&gt;&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
</code></pre></div>
<p dir="auto">In both cases, the URLs are <code class="notranslate">https://external.foo.bar:1234/...</code></p>
<p dir="auto">However, if we try to get the webadmin interface:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474
HTTP/1.1 303 See Other
Location: http://localhost:7474/webadmin
Content-Type: text/html
Access-Control-Allow-Origin: *
Content-Length: 0
Server: Jetty(6.1.25)

$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/webadmin
HTTP/1.1 302 Found
Location: http://localhost:7474/webadmin/
Content-Length: 0
Server: Jetty(6.1.25)"><pre class="notranslate"><code class="notranslate">$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474
HTTP/1.1 303 See Other
Location: http://localhost:7474/webadmin
Content-Type: text/html
Access-Control-Allow-Origin: *
Content-Length: 0
Server: Jetty(6.1.25)

$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/webadmin
HTTP/1.1 302 Found
Location: http://localhost:7474/webadmin/
Content-Length: 0
Server: Jetty(6.1.25)
</code></pre></div>
<p dir="auto">In both cases, the generated URL is <code class="notranslate">http://localhost:7474/</code></p>
<h3 dir="auto">With 2.0.0-M06</h3>
<p dir="auto">The same behaviour is found in 2.0.0-M06</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/
HTTP/1.1 303 See Other
Location: http://localhost:7474/browser
Content-Type: text/html
Access-Control-Allow-Origin: *
Content-Length: 0
Server: Jetty(9.0.5.v20130815)

$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/db/data/
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Access-Control-Allow-Origin: *
Content-Length: 1195
Server: Jetty(9.0.5.v20130815)

[...] &lt;a href=&quot;https://external.foo.bar:1234/db/data/node/0&quot; class=&quot;node&quot;&gt;https://external.foo.bar:1234/db/data/node/0&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;"><pre class="notranslate"><code class="notranslate">$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/
HTTP/1.1 303 See Other
Location: http://localhost:7474/browser
Content-Type: text/html
Access-Control-Allow-Origin: *
Content-Length: 0
Server: Jetty(9.0.5.v20130815)

$ curl -i -H 'Accept: text/html' -H 'X-Forwarded-Host: external.foo.bar:1234' -H 'X-Forwarded-Proto: https' localhost:7474/db/data/
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Access-Control-Allow-Origin: *
Content-Length: 1195
Server: Jetty(9.0.5.v20130815)

[...] &lt;a href="https://external.foo.bar:1234/db/data/node/0" class="node"&gt;https://external.foo.bar:1234/db/data/node/0&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
</code></pre></div>