Skip to content

Instantly share code, notes, and snippets.

@tdavis
Created October 16, 2015 15:02
Show Gist options
  • Select an option

  • Save tdavis/fe5f6762c7a9292634e1 to your computer and use it in GitHub Desktop.

Select an option

Save tdavis/fe5f6762c7a9292634e1 to your computer and use it in GitHub Desktop.
FilterRegistration.Dynamic reg = getServletConfig().getServletContext().addFilter("CORS Filter", "org.ebaysf.web.cors.CORSFilter");
reg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, "/*");
reg.setInitParameters(new HashMap<String, String>() {{
put("cors.allowed.origins", "http://localhost:3449");
put("cors.allowed.headers", "Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Cookie");
put("cors.exposed.headers", "Set-Cookie");
}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment