Skip to content

RegexCorsConfiguration - always calls the super class method #2

@nooscraft

Description

@nooscraft

I'm trying to use your RegexCorsConfiguration I have kind of the same implementation as you except I expose CorsFilter using a FilterRegistrationBean and via @Bean annotation.

        @Bean
        FilterRegistrationBean corsFilter() {
          UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
          CorsConfiguration config = new RegexCorsConfiguration();
          config.setAllowCredentials(true);

          this.corsSettings.getAllowedHeaders().forEach(config::addAllowedHeader);
          this.corsSettings.getAllowedMethods().forEach(config::addAllowedMethod);
          this.corsSettings.getAllowedOrigins().forEach(config::addAllowedOrigin);

          source.registerCorsConfiguration("/**", config);
          FilterRegistrationBean bean = new FilterRegistrationBean<>(new CorsFilter(source));
          bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
          return bean;
        }

But for some reason, it always calls the superclass implementation of the checkOrigin method. Do you have any idea about this? Appreciate your feedback

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions