Page 1 of 1

HSTS Not working

PostPosted: 17. May 2017 23:41
by Pyra_
Ok, so today I was working on my site, attempting to enable HSTS and I did in httpd.conf:

a2enmod headers

<VirtualHost *:443>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"


<VirtualHost *:80>
[...]
ServerName midorimediagroup.us
Redirect permanent / https://midorimediagroup.us/

It said:

6:42:42 PM [Apache] Error: Apache shutdown unexpectedly.
6:42:42 PM [Apache] This may be due to a blocked port, missing dependencies,
6:42:42 PM [Apache] improper privileges, a crash, or a shutdown by another method.
6:42:42 PM [Apache] Press the Logs button to view error logs and check
6:42:42 PM [Apache] the Windows Event Viewer for more clues
6:42:42 PM [Apache] If you need more help, copy and post this
6:42:42 PM [Apache] entire log window on the forums

So here is the log:

(Well the logs were empty.)

Re: HSTS Not working

PostPosted: 18. May 2017 20:25
by gsmith
a2enmod

Only in unixy OSs, I've never seen it in a windows build. Open c:\xampp\apache\conf\httpd.conf and make sure the LoadModule line for mod_headers is uncommented.

If it is already uncommented, try starting apache from a command prompt, you'll definitely see errors then.

Re: HSTS Not working

PostPosted: 02. March 2018 13:31
by edmonaft
hi, i wonder if HSTS is now supported in XAMPP? Hoping that it can be used already :-)

Re: HSTS Not working

PostPosted: 02. March 2018 18:49
by gsmith
HSTS is just setting a special header, Apache's been able to do that for decades now. Apache/1.3.0 had it, and was released 20 years ago come June 6.

mod_headers needs to be loaded to be able to use the Header directive however, probably what the OP had not done and I didn't think of it at the time of my reply. Shame on me!

Re: HSTS Not working

PostPosted: 06. March 2018 08:03
by edmonaft
Wow! You are right! I applied the same settings under my vhosts and it worked! Amazing!!! My HTTPS site is now deployed with HSTS! Thanks!