Skip to content

Commit

Permalink
Skip redirect validation for now #121
Browse files Browse the repository at this point in the history
  • Loading branch information
GordonBeeming committed Nov 6, 2023
1 parent 853d962 commit c083380
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/GordonBeemingCom/Controllers/ExternalController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public ExternalController(ILogger<ExternalController> logger, AppDbContext conte
[HttpGet("/external")]
public IActionResult Index([FromQuery]string link)
{
var referrer = _httpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString();
var host = _httpContextAccessor.HttpContext?.Request.Host.ToString();
var scheme = _httpContextAccessor.HttpContext?.Request.Scheme.ToString();
if (referrer?.StartsWith($"{scheme}://{host}/") != true)
{
return NotFound();
}
// var referrer = _httpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString();
// var host = _httpContextAccessor.HttpContext?.Request.Host.ToString();
// var scheme = _httpContextAccessor.HttpContext?.Request.Scheme.ToString();
// if (referrer?.StartsWith($"{scheme}://{host}/") != true)
// {
// return NotFound();
// }
_logger.LogInformation("External link clicked {link}", link.Replace(Environment.NewLine, ""));

// later we could track this and potentially handle redirects here instead of updating content
Expand Down

0 comments on commit c083380

Please sign in to comment.