Add-KrCorsPolicy

SYNOPSIS

Adds a CORS policy to the Kestrun server.

SYNTAX

Named (Default)

Add-KrCorsPolicy -Builder <CorsPolicyBuilder> -Name <string> [-Server <KestrunHost>] [-PassThru]
 [<CommonParameters>]

Default

Add-KrCorsPolicy -Builder <CorsPolicyBuilder> -Default [-Server <KestrunHost>] [-PassThru]
 [<CommonParameters>]

AllowAll-Named

Add-KrCorsPolicy -Name <string> -AllowAll [-Server <KestrunHost>] [<CommonParameters>]

AllowAll-Default

Add-KrCorsPolicy -Default -AllowAll [-Server <KestrunHost>] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

This function adds a CORS policy to the Kestrun server. It can be used to configure CORS policies for the Kestrun server.

EXAMPLES

EXAMPLE 1

New-KrCorsPolicyBuilder Set-KrCorsMethod -Any Set-KrCorsHeader -Any Add-KrCorsPolicy -Server $server -Name ‘MyCORSPolicy’

EXAMPLE 2

New-KrCorsPolicyBuilder Set-KrCorsMethod -Any Set-KrCorsHeader -Any Add-KrCorsPolicy -Server $server -Default

EXAMPLE 3

Add-KrCorsPolicy -Server $server -Default -AllowAll

EXAMPLE 4

New-KrCorsPolicyBuilder | Set-KrCorsExposedHeader -Headers ‘X-Total-Count’,’X-Page-Number’| Add-KrCorsPolicy -Server $server -Name ‘MyCORSPolicy’

PARAMETERS

-AllowAll

Specifies that the CORS policy should allow all origins, methods, and headers.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: AllowAll-Default
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: AllowAll-Named
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Builder

The CORS policy builder to be used to create the CORS policy.

Type: Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Default
  Position: Named
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: Named
  Position: Named
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Default

Specifies that the CORS policy is the default policy.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: AllowAll-Default
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: Default
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Name

The name of the CORS policy to be added.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Named
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: AllowAll-Named
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-PassThru

Specifies that the CORS policy builder should be passed through the pipeline.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Default
  Position: Named
  IsRequired: false
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: Named
  Position: Named
  IsRequired: false
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Server

The Kestrun server to which the CORS policy will be added.

Type: Kestrun.Hosting.KestrunHost
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder

{{ Fill in the Description }}

System.Management.Automation.SwitchParameter

{{ Fill in the Description }}

OUTPUTS

Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder

{{ Fill in the Description }}

NOTES

This function is part of the Kestrun runtime API and is used to configure CORS policies for the Kestrun server.

{{ Fill in the related links here }}