So I am extraordinarily brave and have a public facing FreeNAS (9.1.1) setup and because of that, I installed a proper SSL certificate for use with HTTPS. Problem is that when configured to use HTTPS, the default Nginix configuration causes it to redirect to the IP address instead of the fully qualified domain name (see: https://bugs.freenas.org/issues/2366).
i.e. if I go to http://nas.beeyourself.com, FreeNAS will redirect you to https://1.2.3.4 which will throw up an error in your web browser since SSL certificates use your domain name.
According to a serverfault thread, the proper Nginx configuration for redirecting http to https (which I've tested on FreeNAS and it totally works) is
but FreeNAS is configured to set it as
My question is what is the best way to make that change persist across reboots without waiting for the next iteration of FreeNAS?
My first guess would be to set a cron job or a startup script to make the edit, but I was hoping there was a less messy solution. (Another solution is always typing in https:// when trying to access my server, so it doesn't need to redirect).
i.e. if I go to http://nas.beeyourself.com, FreeNAS will redirect you to https://1.2.3.4 which will throw up an error in your web browser since SSL certificates use your domain name.
According to a serverfault thread, the proper Nginx configuration for redirecting http to https (which I've tested on FreeNAS and it totally works) is
Code:
return 301 https://$host$request_uri;
Code:
rewrite ^ https://$server_addr:443$request_uri? permanent;
My question is what is the best way to make that change persist across reboots without waiting for the next iteration of FreeNAS?
My first guess would be to set a cron job or a startup script to make the edit, but I was hoping there was a less messy solution. (Another solution is always typing in https:// when trying to access my server, so it doesn't need to redirect).