<div dir="ltr">Hi,<div><br></div><div>I an trying to set the sheme used in automatic redirect generates by nginx when trailing slash is missing. The nginx server is behind a proxy that handles ssl, hence all requests are made using http so nginx use http in absolute redirect.</div><div><br></div><div>Is there a way to configure nginx to use the value of "$http_x_forwarded_proto" ?</div><div><br></div><div>The server conf:</div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"Courier New"">server {<br>    listen  8080;<br>    server_name _;<br>    gzip on;<br>    gzip_disable "msie6";<br>    root /usr/share/nginx/www;<br>    # Prevent redirect to have port 8080<br>    port_in_redirect off;<br><br>    # 404<br>    error_page 404 /404.html;<br><br>    # Redir auto to http<br>    if ($http_x_forwarded_proto = http) {<br>        return 301 https://$host$request_uri;<br>    }<br><br>    # Ensure remote ip is the right one<br>    set_real_ip_from  <a href="http://0.0.0.0/0">0.0.0.0/0</a>;<br>    real_ip_header    X-Forwarded-For;<br>    real_ip_recursive on;<br><br>    # Cache control on image<br>    location ~ ^/fr/(.*\.(bmp|gif|jpeg|jpg|jxr|hdp|wdp|png|svg|svgz|tif|tiff|wbmp|webp|jng|cur|ico|woff|woff2))$ {<br>        add_header Cache-Control public,max-age=86400;<br>        alias /usr/share/nginx/www/$1;<br>    }<br><br>    # Serving data configuration<br>    location ~ ^/fr/(.*) {<br>        include /etc/nginx/redirect/*;<br>        alias /usr/share/nginx/www/$1;<br>    }<br>}<br></pre></div><div><div>Regards,</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><br></div><div dir="ltr"><div style="font-family:Arial,Helvetica,sans-serif;font-size:small;letter-spacing:normal"><table width="450" cellspacing="0" cellpadding="0" border="0" style="font-family:"Times New Roman""><tbody><tr><td width="90" style="vertical-align:top;padding-right:12px"><a href="https://cedreo.com/" style="color:rgb(17,85,204);display:inline-block" target="_blank"><img width="90" src="https://cedreo.com/wp-content/uploads/2018/07/LogoCEDREO.png" style="border:none"></a></td><td width="13" style="border-left:1px solid rgb(0,0,0)"></td><td style="font-family:helvetica,arial;vertical-align:top;color:rgb(105,105,105);font-size:12px"><b><span style="color:rgb(45,168,164);font-size:15px">Jean-Daniel Fischer</span></b><br>Developer  <br><br><span style="font-stretch:normal;line-height:normal"><a style="color:rgb(45,168,164)">+33 (0)2 40 18 04 77</a></span><br>16 Bd Charles de Gaulle, Bât. B<br>44800 Saint-Herblain, France <br><br><table cellpadding="0" border="0"><tbody><tr><td style="padding-right:4px"><a href="https://linkedin.com/company/cedreo/" style="color:rgb(17,85,204);display:inline-block" target="_blank"><img width="25" height="25" src="https://s1g.s3.amazonaws.com/69454e25970e1fd324cd23011926cfb5.png" alt="LinkedIn" style="border:none"></a></td><td style="padding-right:4px"><a href="https://facebook.com/cedreo3d/" style="color:rgb(17,85,204);display:inline-block" target="_blank"><img width="25" height="25" src="https://s1g.s3.amazonaws.com/968211336f9755df82bee306c2810750.png" alt="Facebook" style="border:none"></a></td><td style="padding-right:4px"><a href="https://youtube.com/channel/UCj1QYnZvV8Wbtdivc4GD7CA" style="color:rgb(17,85,204);display:inline-block" target="_blank"><img width="25" height="25" src="https://s1g.s3.amazonaws.com/d064ad6a31fedb1a72cc841da0e2fc82.png" alt="YouTube" style="border:none"></a></td><td style="padding-right:4px"><a href="https://instagram.com/cedreo3D/" style="color:rgb(17,85,204);display:inline-block" target="_blank"><img width="25" height="25" src="https://s1g.s3.amazonaws.com/1197a031ffec48bd092facb4d3442f9a.png" alt="Instagram" style="border:none"></a></td></tr></tbody></table></td></tr></tbody></table><p style="font-family:Arial,"Arial Black",Tahoma,"Trebuchet MS",Verdana,sans-serif;font-size:12px"><font color="#444444" style="letter-spacing:0.2px"><span style="font-size:13px"><span style="font-size:12px"><b><br>Cedreo est noté</b></span></span> </font><span style="letter-spacing:0.2px;color:rgb(170,170,170)"> <a href="https://fr.trustpilot.com/review/www.cedreo.com?utm_medium=Trustbox&utm_source=EmailSignature1" style="color:rgb(17,85,204)" target="_blank"><img src="https://emailsignature.trustpilot.com/signature/fr-FR/1/5b0e92e197ae1c0001e39939/stars.png" border="0" width="128" alt="Trustpilot Stars" style="border:none;max-width:128px;height:auto;display:inline-block;vertical-align:middle;width:128px"></a>  </span><font color="#444444" style="letter-spacing:0.2px">sur </font><font color="#aaaaaa" style="letter-spacing:0.2px"><a href="https://fr.trustpilot.com/review/www.cedreo.com?utm_medium=Trustbox&utm_source=EmailSignature1" style="color:rgb(17,85,204)" target="_blank"><span style="border-width:initial;border-color:initial;height:auto"><img src="https://emailsignature.trustpilot.com/brand/s/1/logo.png" border="0" width="82" alt="Trustpilot Logo" style="border:none;max-width:82px;height:auto;display:inline-block;vertical-align:middle;width:82px"></span> </a></font></p></div></div></div></div></div></div></div></div></div></div></div>