Skip to content
Snippets Groups Projects
Commit 6311f1ed authored by Patrick Zajda's avatar Patrick Zajda
Browse files

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.
parent e39bc1d6
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,13 @@ server {
root <tmpl_var name='web_document_root_www'>;
<tmpl_if name='ssl_enabled'>
<tmpl_if name='rewrite_to_https' op='==' value='y'>
if ($scheme != "https") {
rewrite ^ https://$http_host$request_uri? permanent;
}
</tmpl_if>
</tmpl_if>
<tmpl_if name='seo_redirect_enabled'>
if ($http_host <tmpl_var name='seo_redirect_operator'> "<tmpl_var name='seo_redirect_origin_domain'>") {
rewrite ^ $scheme://<tmpl_var name='seo_redirect_target_domain'>$request_uri? permanent;
......@@ -40,13 +47,6 @@ server {
rewrite ^<tmpl_var name='local_redirect_exclude'>(.*)$ <tmpl_var name='local_redirect_target'>$2 <tmpl_var name='local_redirect_type'>;
}
</tmpl_loop>
<tmpl_if name='ssl_enabled'>
<tmpl_if name='rewrite_to_https' op='==' value='y'>
if ($scheme != "https") {
rewrite ^ https://$http_host$request_uri? permanent;
}
</tmpl_if>
</tmpl_if>
<tmpl_loop name="own_redirects">
<tmpl_if name='use_rewrite'>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment