Reputation: 830
There are any way to disable this security validation:
Load denied by X-Frame-Options: http://localhost:8080/mywebsite/page/1 does not permit framing.
This is occuring because I am trying add my own url into a iframe on my app.
I tried do something like this in the page that responds in the url above:
<% response.addHeader("X-Frame-Options", "ALLOW-FROM: localhost"); %>
<% response.addHeader("X-Frame-Options", "ALLOW"); %>
<% response.addHeader("X-Frame-Options", "SAME-ORIGIN"); %>
None of them worked!
Upvotes: 1
Views: 844
Reputation: 830
The follow code solved my question:
@RequestMapping(value="/page/{id}", method=RequestMethod.GET)
public @ResponseBody ModelAndView load(@PathVariable String id, HttpServletResponse response) {
response.setHeader("X-FRAME-OPTIONS", "SAMEORIGIN");
Map<String,Object> parameters = new HashMap<String,Object>();
...
return new ModelAndView("page", parameters);
}
Upvotes: 1