CORS Configuration Example

    To change the settings for all origins or a specific origin, change the configuration to provide a set of “configurations”. By providing any configuration, the default “wide open” configuration is not configured.

    1. micronaut:
    2. server:
    3. cors:
    4. all:
    5. ...
    6. ...
    7. ...

    In the above example, three configurations are being provided. Their names (all, web, mobile) are not important and have no significance inside Micronaut. They are there purely to be able to easily recognize the intended user of the configuration.

    When a CORS request is made, configurations are searched for allowed origins that are an exact match or match the request origin through a regular expression.