Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Access to the original URL, before any redirects #168

Closed
fvsnippets opened this issue Jun 29, 2020 · 1 comment
Closed

[Request] Access to the original URL, before any redirects #168

fvsnippets opened this issue Jun 29, 2020 · 1 comment

Comments

@fvsnippets
Copy link

fvsnippets commented Jun 29, 2020

Request: I need to access to the original URL, before any redirects.
But, up to this day, after the redirect, the original URL is lost.

Possible solution (modifying your code):

  1. (Extension) Create a new map using id as key.
  2. (Extension) Make that _makeDetails() stores the url in the map if no previous value for that id.
  3. (Extension) Make that _makeDetails() reads the value from that map and add it into a new key "originalUrl".
  4. (User) Use value.originalUrl in my Modify Headers Custom Function.
  5. (Extension) Free memory using a similar mechanism as _autoDeleteSavedHeader().

This is my use case:

Some site forces me to send "Referer" request header (403 otherwise). So adding to the url something similar to "&forceHeader=https%3A%2F%2Fwww.annoyingsite.com". Then using your extension to add the header based on the query string. But that site also answers 403 if the URL is somehow different to the original, including my "alien" query string.
So, using your extension to remove the "alien" query string. But no longer available to the modify headers custom function (detail variable has now the new URL).

Couldn't find a workaround without modifying your extension.

@fvsnippets fvsnippets changed the title [REQJ] [Request] Access to the original URL, before any redirects Jun 29, 2020
@fvsnippets
Copy link
Author

There were some other complications: i.e. media server serves partial content, aka "206", implying new requestIds (so a second map was needed, using the stripped out url as key and the original requestId as value). And sometimes was redirecting me to a new -different- url (so needed to listen to the redirect being executed).
But managed to solve it with the aid of session storage and by adding an onBeforeRedirect listener. So anyone with enough knowledge and imagination can solve the use case raised with out needing to modify the extension.

Of course having the original url available through the complete process woud be cool, but it would involve adding quite a bit of complexity to extension. So, closing my request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant