I searched the same and did not find the answer. No matter how I tried to set it up, the title was always wrong.
My workaround for using delegation of header header from Spring doc framework
Thanks to this, I built the logic to always set SAMEORIGIN, excluding some whitelist:
new DelegatingRequestMatcherHeaderWriter( new NegatedRequestMatcher( new OrRequestMatcher( whiteLists ) ), new XFrameOptionsHeaderWriter(XFrameOptionsMode.SAMEORIGIN);
Logic: if any of the whitelists matches, then do not add a title, otherwise add a title with a SAMEORIGIN value.
I think it's worth considering, because AFAIK not all browsers support ALLOW-FROM.
source share