FKAMP-6: Parse AMP CDN Urls to decide whether to redirect to HTTP or HTTPS



Issue Information

Issue Type: Improvement
 
Priority: Major
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: Anti-AMP Scripts (FKAMP)
Resolution: Done (2019-06-12 15:30:08)
Target version: v1.4.3,

Created: 2019-06-12 12:07:27
Time Spent Working


Description
FKAMP-5 implemented detection of iframe elements referencing cdn.ampproject.org.

Currently the logic, if one's detected is

- Strip the URL fragment
- Split on /
- Take element 5 as the domain name
- Take element 6 onwards as the path
- prepend https://
- Redirect to that value

In an ideal world, all origin sites would be HTTPS, but realistically that's not necessarily true. So, we really should make sure we trigger a redirect to the correct protocol.

Looking at Google's AMP cache documentation, it looks like we can tell from the URL though. If position 4 == s then the origin is HTTPS, if not it's HTTP
Because /s follows the /c prefix, the document will be fetched from example.com using TLS.


So, we should include a check and set the protocol accordingly


Issue Links

Google AMP Cache documentation
Toggle State Changes

Activity



Repo: RemoveAMP
Commit: 0b33a16700e64684313b6c120ad95b95be6359f2
Author: Ben Tasker <btasker@<Domain Hidden>>

Date: Wed Jun 12 12:32:49 2019 +0100
Commit Message: FKAMP-6 Detect whether to redirect to HTTPS or HTTP



Modified (-)(+)
-------
greasemonkey_hook_googlesearch.user.js




Webhook User-Agent

GitHub-Hookshot/d408d22


View Commit

Not had any real luck finding a plaintext site on Google news to test with, but this is certainly working to the extent that it hasn't broken accessing https sites.
btasker changed status from 'Open' to 'Resolved'
btasker added 'Done' to resolution
btasker changed status from 'Resolved' to 'Closed'