Created
August 10, 2020 09:11
-
-
Save rafaelbrizola/1a0359ba5f0c58b4ad0a76f81cd26387 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void run(MyConfiguration configuration, Environment environment) | |
{ | |
// Enable CORS headers | |
final FilterRegistration.Dynamic cors = environment.servlets().addFilter("CORS", CrossOriginFilter.class); | |
// Configure CORS parameters | |
cors.setInitParameter("allowedOrigins", configuration.getAllowedOrigin()); | |
cors.setInitParameter("allowedHeaders", "X-Requested-With,Content-Type,Accept,Origin"); | |
cors.setInitParameter("allowedMethods", "OPTIONS,GET,PUT,POST,DELETE,HEAD"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment