Strict transport security not enforced for 400, 500, 401, and 429 error pages #11589
Replies: 1 comment
-
I am pretty sure that is because those http codes origin from an exception that was thrown "while" the https redirect filter "runs", but because of such an exception the https redirect filter does not finish normally. What I want to say is look at this line: Here you can see the filter calls the next filter and eventually the action method. now if there is an exception within that "next" method chain somewhere, the map and therefore the withHeaders will not be called anymore on the result. So yeah, that is not really ideal, as far as I remember we got similiar reports with other filters as well.
Now the question is: How bad is that behaviour? Because usually you get those errors after your site was visited already, so that means the I don't think it's easy to fix that right now in Play. I could only think of that we have to change the http error handlers so that they check if the httpsredirect filter is enabled and if so and if no header was set it could then set it. IMHO this is not really nice so we might have think about a more general approach how to solve such problems, where a filter should do stuff (like adding headers) no matter if an server side error/exception occured or not , in future What you could do is to add such a check in a custom http error handler youself to make sure you alway add the header if it does not exist yet on the result hat will be sent, I don't think there is another workaround right now. |
Beta Was this translation helpful? Give feedback.
-
Hi All,
We enabled RedirectHttpsFilter filter in our application but Strict Transport Security not enforced for 400, 500, 401, and 429 error pages. All other pages have HSTS header. Is there an additional setting for enforcing HSTS for these error pages as well?
Thanks,
Prudvidhar
Beta Was this translation helpful? Give feedback.
All reactions