Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Saturn/Application.fs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,15 @@ module Application =

{state with AppConfigs=middleware::state.AppConfigs}

///Enables usage of the URL Rewriting Middleware, more information can be found at https://learn.microsoft.com/en-us/aspnet/core/fundamentals/url-rewriting
///Usage example: use_rewriter RewriteOptions().AddRedirectToNonWwwPermanent()
[<CustomOperation("use_rewriter")>]
member __.UseRewriter(state : ApplicationState, options : RewriteOptions) =
let middleware (app : IApplicationBuilder) =
app.UseRewriter options

{state with AppConfigs=middleware::state.AppConfigs}

///Enables application level CORS protection
[<CustomOperation("use_cors")>]
member __.UseCors(state: ApplicationState, policy : string, (policyConfig : CorsPolicyBuilder -> unit ) ) =
Expand Down