<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi there,</p>
    <p>Hmm. I imagine this will be tricky to not run into infinite
      loops, if it's the behaviour of the browser to redirect a HTTP
      page to a HTTPS one.<br>
    </p>
    <p>Wouldn't it just be easier to serve your site over HTTPS? Because
      in order to handle a redirect you'll need a valid TLS certificate
      anyway...<br>
    </p>
    <p>Jore<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 14/8/23 11:56 pm, baalchina wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAbBLB1X1_CCgS+22fp5GfUzs0T4exUNvecvkw8AE-PF_pGDZg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi all,
        <div>I had an nginx as a reserve proxy, with many web sites
          behind. And the nginx listen in 443(https) and 80(http).</div>
        <div><br>
        </div>
        <div>But not all my sites behind support https, so in some sites
          ,I only listen 80, like this:</div>
        <div><i>    server {<br>
                  listen 80;<br>
                  listen [::]:80;<br>
                  server_name  <a href="http://nossl.abc.com/"
              target="_blank" moz-do-not-send="true">nossl.abc.com</a>;<br>
                  location / {<br>
                    proxy_pass_header Server;<br>
                    proxy_set_header Host $http_host;<br>
                    proxy_set_header X-Real-IP $remote_addr;<br>
                    proxy_set_header X-Scheme $scheme;<br>
                    proxy_pass <a href="http://nossl/" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">http://nossl</a>;<br>
                   }<br>
                }</i><br>
        </div>
        <div><br clear="all">
          <div>And I got a problem here, when I using <a
              href="http://nossl.abc.com/" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">http://nossl.abc.com</a>,
            it works fine. But some browser( like edge in a newly
            installed Windows 11), it will auto redirect to the https
            site(<a href="https://nossl.abc.com/" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://nossl.abc.com</a>),
            then we got a default site of my nginx instead of <a
              href="http://nossl.abc.com/" target="_blank"
              moz-do-not-send="true">nossl.abc.com</a></div>
          <div><br>
          </div>
          <div>So, can I redirect the request, when user open <a
              href="https://nossl.abc.com/" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://nossl.abc.com</a>,
            the will be redirect to <a href="http://nossl.abc.com/"
              target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">http://nossl.abc.com</a>?</div>
          <div><br>
          </div>
          <div>Thanks.</div>
        </div>
        <div><br>
        </div>
        <span class="gmail_signature_prefix">-- </span><br>
        <div dir="ltr" class="gmail_signature"
          data-smartmail="gmail_signature">from:baalchina</div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
nginx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:nginx@nginx.org">nginx@nginx.org</a>
<a class="moz-txt-link-freetext" href="https://mailman.nginx.org/mailman/listinfo/nginx">https://mailman.nginx.org/mailman/listinfo/nginx</a>
</pre>
    </blockquote>
  </body>
</html>