Skip to content

Redirects in .NET Core fails to fetch the OpenGraph data and throws an exception #35

Description

@Mzril

Describe the bug
When calling ParseUrlAsync on a url that has a Location header from https to http, an exception is thrown, due to .NET core AllowAutoRedirect not following those redirects. See https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.allowautoredirect?view=net-8.0

To Reproduce
Steps to reproduce the behavior:

  1. Install .NET Core, and this package
  2. Call .ParseUrlAsync on a url such as "https://ygtreasureus.com/" that redirects into "http://www.ygtreasureus.com"
  3. See error

Expected behavior
ParseUrlAsync should not throw the exception, a custom redirecting HttpHandler would be required due to .NET Core not having an option for "DangerousAllowAutoRedirect" see dotnet/runtime#28039

Ideally, an option or a set of options allows us to inject a custom httphandler to the httpdownloader, or there's a flag we can provide to allow for dangerous redirects by the package.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions