Package io.helidon.microprofile.cors


package io.helidon.microprofile.cors

Helidon MP CORS Support

Adding the Helidon MP CORS module to your application enables CORS support automatically, implementing the configuration in the "cors" section of your MicroProfile configuration.

Many MP developers will use the Cors annotations on the endpoint implementations in their code to set up the CORS behavior, but any values in configuration will override the annotations or set up CORS for endpoints without the annotation.

Here is an example of the configuration format:

   cors:
     enabled: true # this is the default
     paths:
       - path-pattern: /cors1
         allow-origins: ["*"]
         allow-methods: ["*"]
       - path-pattern: /cors2
         allow-origins: ["http://foo.bar", "http://bar.foo"]
         allow-methods: ["DELETE", "PUT"]
         allow-headers: ["X-bar", "X-foo"]
         allow-credentials: true
         max-age: PT1H # Duration format (1 hour)
 
  • Class
    Description
    CDI extension for processing CORS-annotated types.
    Deprecated, for removal: This API element is subject to removal in a future version.
    use annotations from Cors to configure CORS; each method in this annotation is equivalent to an annotation class in the referenced class.