Add check to see if return value is DENY
Originally, if the return from getAllowFromValue(request) is "DENY", then the X-Frame-Options header's value will proceed to be written as "ALLOW FROM DENY" - an invalid value. This commit adds a condition in the if clause that checks whether allowFromValue is "DENY". This way, the X-Frame-Options header will be written as "ALLOW FROM origin" or "DENY".
This commit is contained in:
parent
bed4ec7d18
commit
02a78b17b9
|
@ -83,7 +83,7 @@ public final class XFrameOptionsHeaderWriter implements HeaderWriter {
|
|||
public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (XFrameOptionsMode.ALLOW_FROM.equals(frameOptionsMode)) {
|
||||
String allowFromValue = allowFromStrategy.getAllowFromValue(request);
|
||||
if (allowFromValue != null) {
|
||||
if (allowFromValue != null && !allowFromValue.equals(XFrameOptionsMode.DENY.getMode())) {
|
||||
response.setHeader(XFRAME_OPTIONS_HEADER,
|
||||
XFrameOptionsMode.ALLOW_FROM.getMode() + " " + allowFromValue);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue