File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55using Shared ;
66using Web . Extensions ;
77using Web . Services ;
8+ using Microsoft . AspNetCore . Rewrite ;
89
910var builder = WebApplication . CreateBuilder ( args ) ;
1011
9697
9798var app = builder . Build ( ) ;
9899
100+ var options = new RewriteOptions ( )
101+ . AddRedirectToNonWwwPermanent ( ) ;
102+ //.AddRedirectToHttpsPermanent();
103+ app . UseRewriter ( options ) ;
104+
99105// Configure the HTTP request pipeline.
100106if ( ! app . Environment . IsDevelopment ( ) )
101107{
102- app . UseExceptionHandler ( "/Error" ) ;
103- app . UseHsts ( ) ;
104-
105- // Enable compression and caching only in production
106- app . UseResponseCompression ( ) ;
107- app . UseResponseCaching ( ) ;
108- app . UseOutputCache ( ) ;
108+ app . UseExceptionHandler ( "/Error" ) ;
109+ app . UseHsts ( ) ;
110+
111+ // Enable compression and caching only in production
112+ app . UseResponseCompression ( ) ;
113+ app . UseResponseCaching ( ) ;
114+ app . UseOutputCache ( ) ;
109115}
110116else
111117{
112- app . UseDeveloperExceptionPage ( ) ;
118+ app . UseDeveloperExceptionPage ( ) ;
113119}
114120
115121// Enable compression and caching early in the pipeline
You can’t perform that action at this time.
0 commit comments