Pavlos Parissis <pavlos.parissis@...> writes:

> On 2 December 2014 at 09:17, Samuel Reed <samuel.trace.reed <at>> 
wrote:I'm running the latest 1.5 release.
> Our site runs primarily on the `www` subdomain, but we want to enable HSTS for
> all subdomains (includeSubdomains). Unfortunately, due to the way HSTS works,
> the HSTS header MUST be present on the redirect from 
to I am using configuration like:
> rspadd Strict-Transport-Security:\ max-age=31536000;\ includeSubDomains
> redirect prefix code 301 if \
> { hdr(host) -i }
> For whatever reason, even when the rspadd line is before the redirect, no
> headers are added to the redirect, making this impossible. I've considered
> a fake backend with a fake 503 file to get around this - something like:
> HTTP/1.1 301 Moved Permanently
> Cache-Control: no-cache
> Content-Length: 0
> Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
> Location:
> Connection: close
> While this will work, it feels really hacky. Is there a better way to add a
> header on a redirect?
> Have a look at the thread 'add response header based on presence of request 
header', your case matches the case I mentioned there.
> Cheers,Pavlos

Hi Pavlos - unfortunately this does not match my use case,
I always want to send the HSTS header, it is not dependent 
on the request. I just need to ensure that this 
header is *always* sent, even on a redirect.

Reply via email to