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

Provide an API for modifying URL rewriting #47

Open
robertknight opened this issue Jan 13, 2021 · 1 comment
Open

Provide an API for modifying URL rewriting #47

robertknight opened this issue Jan 13, 2021 · 1 comment

Comments

@robertknight
Copy link
Contributor

For Hypothesis's proxy service we are looking to ensure that all requests to the proxy from a browser are either top-level page fetches or requests from a proxied page. In other words, we want to prevent direct requests of subresources (scripts etc.) from outside of proxied pages.

One approach we are looking at is modifying the URL rewriting process so that subresource URLs on proxied pages include a token of some kind. For this purpose it would be useful to be able to hook into client-side URL rewriting (ie. the rewriteUrl method) and modify the generated URLs.

Although it is possible to do this with the current version of Wombat via monkey-patching it would be preferable to have a documented, public API for this. I'd be happy to help with implementation/testing, but I could use some direction on how the process of configuring Wombat to use this middleware could work.

@mgautierfr
Copy link
Contributor

FYI, PR #128 allow you to provide a custom rewrite_function in the configuration.
(You still have "reverse rewritting" https://github.com/webrecorder/wombat/blob/main/src/wombat.js#L942 running so your rewrite_function must be "compatible" with it)

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

2 participants