Talvez o problema seja que a diretiva Header edit
seja executada antes que seu aplicativo produza uma resposta, portanto, se o aplicativo estiver produzindo o cabeçalho que você deseja editar, esse cabeçalho ainda não existirá no momento em que a diretiva for executada.
Segundo a documentação:
Header
[condition]set|append|merge|add|unset|echo|edit header [value] [replacement] [early|env=[!]variable]
The optional condition argument determines which internal table of responses headers this directive will operate against. Other components of the server may have stored their response headers in either the table that corresponds to
onsuccess
or the table that corresponds to always."Always"
in this context refers to whether headers you add will be sent during both a successful and unsucessful response, but if your action is a function of an existing header, you will have to read on for further complications.The default value of
onsuccess
may need to be changed to always under the circumstances similar to those listed below. Note also that repeating this directive with both conditions makes sense in some scenarios because always is not a superset of onsuccess with respect to existing headers:
- You're adding a header to a non-success (non-2xx) response, such as a redirect, in which case only the table corresponding to always is used in the ultimate response.
- You're modifying or removing a header generated by a CGI script, in which case the CGI scripts are in the table corresponding to always
and not in the default table.- You're modifying or removing a header generated by some piece of the server but that header is not being found by the default onsuccess condition.
REF: link
Você pode corrigir isso usando Header always edit
.
Eg.
Header always edit Set-Cookie "(?i)^((?:(?!;\s?HttpOnly).)+)$" "$1; HttpOnly"
Header always edit Set-Cookie "(?i)^((?:(?!;\s?secure).)+)$" "$1; secure"
Espero que isso ajude.