Apache template ... but for SSL only

when we go to Virtualmin > System setting > Server template, it is possible to change a lot of templates (for BIND, MySql, … and for Apache). Yet this template for Apache is active for both :80 and :443 (SSL) virtualhosts. But i’m looking for a way to add a line just for the :443 (SSL) virtualhosts. More specificatlly, I’d like to add some lines to put the header “Strict-Transport-Security” command and the SSLUseStapling command (but it would be the same thing for an other one).

I tried by an “include” directly in Apache server config, but it has not been very convincing … I haven’t find a function which could call a command only for :443 (SSL) virtualhost automatically.

Is there a way to do that by modifying the template ? Or it must be done each time for each new virtualhost ?



Hmm, you may need to make use of a conditional block… I don’t know what the right syntax is here, but it may be something like this:

$IF-SSL Strict-Transport-Security $ENDIF-SSL

Does that do the trick for you?


Hi, thanks for your answer, but it doesn’t make the job. The line I add is still added in :80 and :443 virtualhosts. Nevertheless, I have a lead now and I know where to look for.