Class CorsConfig

java.lang.Object
vaultWeb.config.CorsConfig

@Configuration public class CorsConfig extends Object
Global CORS configuration Source for the application.

This configuration allows the frontend application running on a different origin (e.g., http://localhost:4200) to make HTTP requests to the backend without being blocked by the browser's same-origin policy.

It allows all HTTP methods, headers, and credentials to be sent.

  • Constructor Details

    • CorsConfig

      public CorsConfig()
  • Method Details

    • corsConfigurationSource

      @Bean public org.springframework.web.cors.CorsConfigurationSource corsConfigurationSource()
      Defines a CORS Configuration source that applies the CORS configuration to all endpoints.
      Returns:
      CorsFilter instance that intercepts requests and adds necessary CORS headers for allowed origins, methods, headers, and credentials.