4IRL / urls4irl

Sharing URL's with friends.
3 stars 0 forks source link

Fix headers for url validation #190

Closed GPropersi closed 2 months ago

GPropersi commented 2 months ago

Another fix for URL validation. Includes the Host HTTP header on HEAD/GET request for the given URL. The url_normalize library is used to pull out the host name from the normalized url.

When a user adds a URL, their User-Agent is pulled from their HTTP request, and is placed into the URL validation HTTP headers.

Previously, all of the user's HTTP headers from their request to validate were used to validate the URL. This was incorrect as the user's HTTP request as an AJAX POST request using CORS - all of the additional headers caused the HEAD/GET requests for URL validation to immediately fail.