Explorar o código

Add Access-Control-Allow-Origin header to exceptions

Fixes #1794
ConfusedPolarBear %!s(int64=5) %!d(string=hai) anos
pai
achega
df65e3ab0d
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

+ 5 - 0
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -542,6 +542,11 @@ namespace Emby.Server.Implementations.HttpServer
                     var requestInnerEx = GetActualException(requestEx);
                     var statusCode = GetStatusCode(requestInnerEx);
 
+                    if (!httpRes.Headers.ContainsKey("Access-Control-Allow-Origin"))
+                    {
+                        httpRes.Headers.Add("Access-Control-Allow-Origin", "*");
+                    }
+
                     // Do not handle 500 server exceptions manually when in development mode
                     // The framework-defined development exception page will be returned instead
                     if (statusCode == 500 && _hostEnvironment.IsDevelopment())