Howdy. Our prod site is only served over https so we wanted our local environment to follow suit. The easiest way we've found to accomplish this was running the following script prior to provisioning:
# While in `/content`
cd ../puppet/modules/chassis/templates/
# Strip off any trailing "\n" in `site.nginx.conf.erb` | remove last line, the closing `}` > save changes
awk '/^$/ {nls=nls "\n";next;} {printf "%s",nls; nls=""; print;}' site.nginx.conf.erb | sed '$d' > nginx-tmp && mv nginx-tmp site.nginx.conf.erb
# Add SSL redirect and replace closing `}`
echo '
\tif ($scheme = http) {
\t\treturn 301 https://$server_name$request_uri;
\t}
}
' >> site.nginx.conf.erb
Any thoughts as to a cleaner way of forcing HTTPS on created sites? Is this something that can potentially (optionally) be done via extension?
Howdy. Our prod site is only served over https so we wanted our local environment to follow suit. The easiest way we've found to accomplish this was running the following script prior to provisioning:
Any thoughts as to a cleaner way of forcing HTTPS on created sites? Is this something that can potentially (optionally) be done via extension?