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

Add feature to modify URLs in ruleset | Fix Relative URLs #31

Merged
merged 7 commits into from
Nov 14, 2023

Conversation

deoxykev
Copy link
Contributor

@deoxykev deoxykev commented Nov 12, 2023

This PR adds a feature to modify the requested URL. This is useful for getting the AMP, Search Engine Cache or Archive site versions of a site.

The proposed ruleset API would look like this:

  urlMods:
    query:
      - key: amp
        value: 1

(this would have the effect of appending ?amp=1 to the end of the requested domain.

A working example has been added to fix #30


There is also an API to modify the Domain and Path of the URL by regex, which I have briefly documented in the README.md.

@deoxykev deoxykev changed the title Add feature to modify URLs in ruleset Add feature to modify URLs in ruleset | Fix Relative URLs Nov 12, 2023
@deoxykev
Copy link
Contributor Author

This will also fix #3

replace: amp # (this would modify the domain from www.tagesspiegel.de to amp.tagesspielgel.de)
path:
- match: ^ # regex to match part of path
replace: /amp/ # (modify the url from https://www.tagesspiegel.de/internationales/ to https://www.tagesspiegel.de/amp/internationales/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is dope! I like the flexibility

@mms-gianni
Copy link
Contributor

Nice work @deoxykev !

@mms-gianni mms-gianni merged commit af10efb into everywall:main Nov 14, 2023
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

Successfully merging this pull request may close these issues.

Cloudlfare again
2 participants