Annotation Interface CrossOrigin


@Documented @Inherited @Retention(RUNTIME) @Target({TYPE,METHOD}) public @interface CrossOrigin
Support CORs configuration via annotation. For example, it will enable Micronaut developers only to allow CORS for a few routes in their applications. Thus, having more secure applications.
Since:
3.9.0
  • Element Details

    • value

      @AliasFor(member="allowedOrigins") String[] value
      Returns:
      the origins for which cross-origin requests are allowed
      Default:
      {}
    • allowedOrigins

      @AliasFor(member="value") String[] allowedOrigins
      Returns:
      the origins for which cross-origin requests are allowed
      Default:
      {}
    • allowedOriginsRegex

      String allowedOriginsRegex
      Returns:
      regular expression to match allowed origins
      Default:
      ""
    • allowedHeaders

      String[] allowedHeaders
      Returns:
      request headers permitted in requests
      Default:
      {}
    • exposedHeaders

      String[] exposedHeaders
      Returns:
      response headers that user-agent will allow client to access on actual response
      Default:
      {}
    • allowedMethods

      HttpMethod[] allowedMethods
      Returns:
      supported HTTP request methods
      Default:
      {}
    • allowCredentials

      boolean allowCredentials
      Returns:
      whether the browser should send credentials
      Default:
      true
    • allowPrivateNetwork

      boolean allowPrivateNetwork
      Returns:
      should the browser have access to the local network
      Since:
      4.3.0
      Default:
      true
    • maxAge

      long maxAge
      Returns:
      maximum age (in seconds) of the cache duration for preflight responses
      Default:
      1800L