Skip to content

Commit 6311f1e

Browse files
committed
Put http to https redirect before SEO in Nginx virtualhost.
It makes better the compliance with HSTS, http to https redirect must be done before domain to www.domain.
1 parent e39bc1d commit 6311f1e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

server/conf/nginx_vhost.conf.master

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ server {
2525

2626
root <tmpl_var name='web_document_root_www'>;
2727

28+
<tmpl_if name='ssl_enabled'>
29+
<tmpl_if name='rewrite_to_https' op='==' value='y'>
30+
if ($scheme != "https") {
31+
rewrite ^ https://$http_host$request_uri? permanent;
32+
}
33+
</tmpl_if>
34+
</tmpl_if>
2835
<tmpl_if name='seo_redirect_enabled'>
2936
if ($http_host <tmpl_var name='seo_redirect_operator'> "<tmpl_var name='seo_redirect_origin_domain'>") {
3037
rewrite ^ $scheme://<tmpl_var name='seo_redirect_target_domain'>$request_uri? permanent;
@@ -40,13 +47,6 @@ server {
4047
rewrite ^<tmpl_var name='local_redirect_exclude'>(.*)$ <tmpl_var name='local_redirect_target'>$2 <tmpl_var name='local_redirect_type'>;
4148
}
4249
</tmpl_loop>
43-
<tmpl_if name='ssl_enabled'>
44-
<tmpl_if name='rewrite_to_https' op='==' value='y'>
45-
if ($scheme != "https") {
46-
rewrite ^ https://$http_host$request_uri? permanent;
47-
}
48-
</tmpl_if>
49-
</tmpl_if>
5050

5151
<tmpl_loop name="own_redirects">
5252
<tmpl_if name='use_rewrite'>

0 commit comments

Comments
 (0)