Class CorsConfig

java.lang.Object
com.linecorp.armeria.server.cors.CorsConfig

public final class CorsConfig
extends Object
See Also:
CorsServiceBuilder, CorsService.config()
  • Method Details

    • isAnyOriginSupported

      public boolean isAnyOriginSupported()
      Determines whether a wildcard origin, '*', is supported.
      Returns:
      true if any origin is allowed.
    • isShortCircuit

      public boolean isShortCircuit()
      Determines whether a CORS request should be rejected if it's invalid before being further processing.

      CORS headers are set after a request is processed. This may not always be desired and this setting will check that the Origin is valid and if it is not valid no further processing will take place, and a error will be returned to the calling client.

      Returns:
      true if a CORS request should short-circuit upon receiving an invalid Origin header.
    • policies

      public List<CorsPolicy> policies()
      Returns the policies.
    • getPolicy

      @Nullable public CorsPolicy getPolicy​(@Nullable String origin, RoutingContext routingContext)
      Returns the policy for the specified origin.
      Returns:
      CorsPolicy which allows the origin, null if the origin is null or not allowed in any policy.
    • toString

      public String toString()
      Overrides:
      toString in class Object