mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Fixed CDN not checking the right headers
This commit is contained in:
parent
b9bc4986df
commit
951635fcbe
@ -24,9 +24,16 @@ namespace Teknik.Modules
|
|||||||
string origin = (requestContext.Request.IsLocal) ? "*" : requestContext.Request.Headers.Get("Origin");
|
string origin = (requestContext.Request.IsLocal) ? "*" : requestContext.Request.Headers.Get("Origin");
|
||||||
|
|
||||||
// Is the referrer set to the CDN and we are using a CDN?
|
// Is the referrer set to the CDN and we are using a CDN?
|
||||||
if (config.UseCdn && requestContext.Request.Headers.Get("Referer") == config.CdnHost)
|
if (config.UseCdn && !string.IsNullOrEmpty(config.CdnHost))
|
||||||
{
|
{
|
||||||
origin = requestContext.Request.Headers.Get("Host");
|
try
|
||||||
|
{
|
||||||
|
string host = requestContext.Request.Headers.Get("Host");
|
||||||
|
Uri uri = new Uri(config.CdnHost);
|
||||||
|
if (host == uri.Host)
|
||||||
|
origin = host;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
string domain = (string.IsNullOrEmpty(origin)) ? string.Empty : origin.GetDomain();
|
string domain = (string.IsNullOrEmpty(origin)) ? string.Empty : origin.GetDomain();
|
||||||
|
Loading…
Reference in New Issue
Block a user