| 
					
				 | 
			
			
				@@ -16,12 +16,13 @@ using Jellyfin.Api.Auth.RequiresElevationPolicy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Jellyfin.Api.Constants; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Jellyfin.Api.Controllers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Jellyfin.Server.Formatters; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using Jellyfin.Server.Models; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using Jellyfin.Server.Middleware; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using MediaBrowser.Common.Json; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using MediaBrowser.Model.Entities; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Microsoft.AspNetCore.Authentication; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Microsoft.AspNetCore.Authorization; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Microsoft.AspNetCore.Builder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using Microsoft.AspNetCore.Cors.Infrastructure; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Microsoft.AspNetCore.HttpOverrides; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Microsoft.Extensions.DependencyInjection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using Microsoft.OpenApi.Models; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -134,18 +135,15 @@ namespace Jellyfin.Server.Extensions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="serviceCollection">The service collection.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="pluginAssemblies">An IEnumerable containing all plugin assemblies with API controllers.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// /// <param name="corsHosts">The configured cors hosts.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns>The MVC builder.</returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static IMvcBuilder AddJellyfinApi( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this IServiceCollection serviceCollection, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            IEnumerable<Assembly> pluginAssemblies, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            string[] corsHosts) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IEnumerable<Assembly> pluginAssemblies) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             IMvcBuilder mvcBuilder = serviceCollection 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .AddCors(options => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    options.AddPolicy(ServerCorsPolicy.DefaultPolicyName, new ServerCorsPolicy(corsHosts).Policy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .AddCors() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .AddTransient<ICorsPolicyProvider, CorsPolicyProvider>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .Configure<ForwardedHeadersOptions>(options => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; 
			 |