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

Filter query parameters #5

Closed
rjyo opened this issue May 31, 2020 · 0 comments
Closed

Filter query parameters #5

rjyo opened this issue May 31, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@rjyo
Copy link
Collaborator

rjyo commented May 31, 2020

Plan

As mention in #1

Add a new API for filtering out the unwanted parameters:

in the config file .next-boost.js, if we add the following config:

module.exports = {
  ...
  paramFilter: (p) => {
    p === 'fbclid' || p.startsWith('utm_') ? false : true
  },
}

In paramFilter, we just return true for the params you want to keep and false for those you want to remove.

With the filter, /path?fbclid=abc will be transformed to /path before searching the cache.

Effect

Before:

No paramFilter

  • miss: /url_a
  • miss: /url_a?utm_source=facebook

After:

with paramFilter:

(p) => !p.startsWith('utm_')
  • miss: /url_a
  • hit: /url_a?utm_source=facebook
rjyo added a commit that referenced this issue May 31, 2020
rjyo added a commit that referenced this issue May 31, 2020
@rjyo rjyo closed this as completed Jun 1, 2020
@rjyo rjyo added the enhancement New feature or request label Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant