Chris
Chris

Reputation: 3657

Dropwizard + Katharsis: Preflight (OPTIONS) returns 404

I'm not sure how to configure these two libraries to correctly handle preflight requests (coming from Ember.js). Using the filter below works just fine with a standard Dropwizard/Jersey resource but does nothing when Katharsis is brought into play

        FilterRegistration.Dynamic filter = environment.servlets().addFilter("CORS", CrossOriginFilter.class);
        filter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, environment.getApplicationContext().getContextPath() + "*");
        filter.setInitParameter(ALLOWED_METHODS_PARAM, "OPTIONS,GET,PUT,POST,DELETE,HEAD");
        filter.setInitParameter(ALLOWED_ORIGINS_PARAM, "*");
        filter.setInitParameter(ALLOWED_HEADERS_PARAM, "Content-Type," + "X-Requested-With," + "Accept," + "Origin," + "Authorization," + "Access-Control-Request-Method," + "Access-Control-Request-Headers," + "Access-Control-Allow-Origin");
        filter.setInitParameter(ALLOW_CREDENTIALS_PARAM, "true");
        filter.setInitParameter(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "*");

I can find a few examples of how people solve this using Spring, but I can't seem to adapt those to suit either.

Do I need to register something specific with Katharsis?

Upvotes: 0

Views: 354

Answers (1)

Christian Bongiorno
Christian Bongiorno

Reputation: 5648

OPTIONS is current not supported in Katharsis - it's a long requested feature.

Upvotes: 0

Related Questions