<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello,</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">You can try adding an 'error_page 301
@returnme' and then a location like this:</div>
<div class="moz-cite-prefix">location @returnme {</div>
<div class="moz-cite-prefix"> return 301
<a class="moz-txt-link-freetext" href="https://$host$uri/$is_args$args">https://$host$uri/$is_args$args</a>;<br>
</div>
<div class="moz-cite-prefix">}</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Regards,</div>
<div class="moz-cite-prefix">Igor<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 22.08.2019 16:22, Jean-Daniel
FISCHER wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CANnXiva6hOPOuR5RbrOQn9VXSdr2rsL=HOyKEPq=_CBM_M2DBw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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 {
listen 8080;
server_name _;
gzip on;
gzip_disable "msie6";
root /usr/share/nginx/www;
# Prevent redirect to have port 8080
port_in_redirect off;
# 404
error_page 404 /404.html;
# Redir auto to http
if ($http_x_forwarded_proto = http) {
return 301 <a class="moz-txt-link-freetext" href="https://$host$request_uri">https://$host$request_uri</a>;
}
# Ensure remote ip is the right one
set_real_ip_from <a href="http://0.0.0.0/0" moz-do-not-send="true">0.0.0.0/0</a>;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
# Cache control on image
location ~ ^/fr/(.*\.(bmp|gif|jpeg|jpg|jxr|hdp|wdp|png|svg|svgz|tif|tiff|wbmp|webp|jng|cur|ico|woff|woff2))$ {
add_header Cache-Control public,max-age=86400;
alias /usr/share/nginx/www/$1;
}
# Serving data configuration
location ~ ^/fr/(.*) {
include /etc/nginx/redirect/*;
alias /usr/share/nginx/www/$1;
}
}
</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 style="font-family:"Times New
Roman"" width="450" cellspacing="0"
cellpadding="0" border="0">
<tbody>
<tr>
<td
style="vertical-align:top;padding-right:12px"
width="90"><a
href="https://cedreo.com/"
style="color:rgb(17,85,204);display:inline-block"
target="_blank"
moz-do-not-send="true"><img
src="https://cedreo.com/wp-content/uploads/2018/07/LogoCEDREO.png"
style="border:none"
moz-do-not-send="true"
width="90"></a></td>
<td style="border-left:1px solid
rgb(0,0,0)" width="13"><br>
</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)"
moz-do-not-send="true">+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"
moz-do-not-send="true"><img
src="https://s1g.s3.amazonaws.com/69454e25970e1fd324cd23011926cfb5.png"
alt="LinkedIn"
style="border:none"
moz-do-not-send="true"
width="25" height="25"></a></td>
<td style="padding-right:4px"><a
href="https://facebook.com/cedreo3d/"
style="color:rgb(17,85,204);display:inline-block"
target="_blank"
moz-do-not-send="true"><img
src="https://s1g.s3.amazonaws.com/968211336f9755df82bee306c2810750.png"
alt="Facebook"
style="border:none"
moz-do-not-send="true"
width="25" height="25"></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"
moz-do-not-send="true"><img
src="https://s1g.s3.amazonaws.com/d064ad6a31fedb1a72cc841da0e2fc82.png"
alt="YouTube"
style="border:none"
moz-do-not-send="true"
width="25" height="25"></a></td>
<td style="padding-right:4px"><a
href="https://instagram.com/cedreo3D/"
style="color:rgb(17,85,204);display:inline-block"
target="_blank"
moz-do-not-send="true"><img
src="https://s1g.s3.amazonaws.com/1197a031ffec48bd092facb4d3442f9a.png"
alt="Instagram"
style="border:none"
moz-do-not-send="true"
width="25" height="25"></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
style="letter-spacing:0.2px"
color="#444444"><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" moz-do-not-send="true"><img
src="https://emailsignature.trustpilot.com/signature/fr-FR/1/5b0e92e197ae1c0001e39939/stars.png"
alt="Trustpilot Stars"
style="border:none;max-width:128px;height:auto;display:inline-block;vertical-align:middle;width:128px"
moz-do-not-send="true" width="128"
border="0"></a> </span><font
style="letter-spacing:0.2px"
color="#444444">sur </font><font
style="letter-spacing:0.2px"
color="#aaaaaa"><a
href="https://fr.trustpilot.com/review/www.cedreo.com?utm_medium=Trustbox&utm_source=EmailSignature1"
style="color:rgb(17,85,204)"
target="_blank" moz-do-not-send="true"><span
style="border-width:initial;border-color:initial;height:auto"><img
src="https://emailsignature.trustpilot.com/brand/s/1/logo.png"
alt="Trustpilot Logo"
style="border:none;max-width:82px;height:auto;display:inline-block;vertical-align:middle;width:82px"
moz-do-not-send="true" width="82"
border="0"></span> </a></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></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="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a></pre>
</blockquote>
<p><br>
</p>
</body>
</html>