Hi, I would like to know if it possible to get static sites generated by Hugo to work with both HTTPS and HTTP? The main problem is the baseURL, as far as I remember, the menu items use it as a reference to link other pages… the problem is, if HTTP is used in baseURL, the menu items will always point towards the HTTP URLs… even if a users accesses the page via HTTPS.
What I want is that the menu should use HTTPS link in the menu if the user used HTTPS to access the site… same for HTTP pages, HTTP links for HTTP pages
I know a possible workaround, generate the site 2 times using both HTTP and HTTPS version of the baseURL, but it really isn’t the answer to my question
Is there something else which could address this issue? Thanks in Advance!
Well, there is some good news. The answer to your question is unequivocally “yes.” The bad news is that the questions you’re asking are really unrelated to Hugo and more about how you set your hosting/service/etc.
If you’re serving over HTTPS, I would just force SSL. Is there any reason why you would want to do both?
If you use Netlify for your hosting (it’ll likely be free), forcing SSL is (literally) just a matter of a single checkbox:
I think you have mis-understood me @rdwatters, what I want to do is, server the pages via both HTTP and HTTPS… not forcing HTTPS only.
The problem is, the reference of a particular protocol in the HTML documents… it is either HTTP or HTTPS. I want the visitors of my site have a choice of using HTTPS if they want… but it is not forced in anyway. The pages load fine in HTTPS, but external content like stylesheets and images are loaded over HTTP because the HTML code references the HTTP URL… Same for the links in the page, they are all HTTP links.