Browse Source

Added method to check to see if CDN is passing the request and then pass back the CDN as the origin.

tags/3.0.0
Teknikode 1 year ago
parent
commit
b9bc4986df
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      Teknik/Modules/CORSModule.cs

+ 7
- 0
Teknik/Modules/CORSModule.cs View File

@@ -22,6 +22,13 @@ namespace Teknik.Modules

// Allow this domain, or everything if local
string origin = (requestContext.Request.IsLocal) ? "*" : requestContext.Request.Headers.Get("Origin");

// Is the referrer set to the CDN and we are using a CDN?
if (config.UseCdn && requestContext.Request.Headers.Get("Referer") == config.CdnHost)
{
origin = requestContext.Request.Headers.Get("Host");
}

string domain = (string.IsNullOrEmpty(origin)) ? string.Empty : origin.GetDomain();

if (string.IsNullOrEmpty(origin))

Loading…
Cancel
Save