Package io.micronaut.http.server
Class HttpServerConfiguration.CorsConfiguration
- java.lang.Object
-
- io.micronaut.http.server.HttpServerConfiguration.CorsConfiguration
-
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
- Enclosing class:
- HttpServerConfiguration
@ConfigurationProperties("cors") public static class HttpServerConfiguration.CorsConfiguration extends java.lang.Object implements io.micronaut.core.util.ToggleableConfiguration for CORS.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_ENABLEDstatic booleanDEFAULT_LOCALHOST_PASS_THROUGHstatic booleanDEFAULT_SINGLE_HEADER
-
Constructor Summary
Constructors Constructor Description CorsConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,CorsOriginConfiguration>getConfigurations()booleanisEnabled()booleanisLocalhostPassThrough()booleanisSingleHeader()voidsetConfigurations(java.util.Map<java.lang.String,CorsOriginConfiguration> configurations)Sets the CORS configurations.voidsetEnabled(boolean enabled)Sets whether CORS is enabled.voidsetLocalhostPassThrough(boolean localhostPassThrough)Sets whether localhost pass-through is enabled.voidsetSingleHeader(boolean singleHeader)Sets whether CORS header values should be joined into a single header.
-
-
-
Field Detail
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
- See Also:
- Constant Field Values
-
DEFAULT_SINGLE_HEADER
public static final boolean DEFAULT_SINGLE_HEADER
- See Also:
- Constant Field Values
-
DEFAULT_LOCALHOST_PASS_THROUGH
public static final boolean DEFAULT_LOCALHOST_PASS_THROUGH
- See Also:
- Constant Field Values
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceio.micronaut.core.util.Toggleable- Returns:
- Whether cors is enabled. Defaults to false.
-
isLocalhostPassThrough
public boolean isLocalhostPassThrough()
- Returns:
- Whether localhost pass-through is enabled. Defaults to false.
- Since:
- 3.8.5
-
getConfigurations
public java.util.Map<java.lang.String,CorsOriginConfiguration> getConfigurations()
- Returns:
- The cors configurations
-
isSingleHeader
public boolean isSingleHeader()
- Returns:
- Whether headers should be combined into a single header
-
setEnabled
public void setEnabled(boolean enabled)
Sets whether CORS is enabled. Default value (false)- Parameters:
enabled- True if CORS is enabled
-
setLocalhostPassThrough
public void setLocalhostPassThrough(boolean localhostPassThrough)
Sets whether localhost pass-through is enabled. Default value false. Setting this to true will allow requests to be made to localhost from any origin.- Parameters:
localhostPassThrough- True if localhost pass-through is enabled- Since:
- 3.8.5
-
setConfigurations
public void setConfigurations(java.util.Map<java.lang.String,CorsOriginConfiguration> configurations)
Sets the CORS configurations.- Parameters:
configurations- The CORS configurations
-
setSingleHeader
public void setSingleHeader(boolean singleHeader)
Sets whether CORS header values should be joined into a single header. Default value (false).- Parameters:
singleHeader- The single header flag
-
-