Code Monkey home page Code Monkey logo

Comments (7)

Dridi avatar Dridi commented on June 3, 2024 1

Actually, the point of regfilter is to match the parameter itself, so that you don't need to take care of the separators. When I asked for an example I meant VCL code, sorry for the ambiguity. But from your two log records you could probably use regfilter this way:

querystring.regfilter(req.url, "v|ver")

It may be a bit too inclusive, so you way want to harden it this way:

querystring.regfilter(req.url, "^(v|ver)$")

It is more readable and should actually work with both examples. And as a matter of fact your second example didn't work, the query string is still there in the returned value.

When in doubt, you can instead rely on the more verbose filter:

querystring.filter(req.url, "v" + querystring.filtersep() + "ver");

But this one can grow out of control if you have too many parameters like all the one you can get if you have a google analytics campaign.

from libvmod-querystring.

Dridi avatar Dridi commented on June 3, 2024

Could you please either show me a test case or the varnishlog output of such a transaction?

At first glance I would say that your first regex looks wrong, it contains spaces that probably prevent you from reaching line 3.

from libvmod-querystring.

blindpet avatar blindpet commented on June 3, 2024

Sorry that was a typo, I can see the querystring.remove working

30 VCL_call     c vmod_remove("/wp-content/themes/generatepress/style.css?devbproto-refresh=0.4084768013563007") "/wp-content/themes/generatepress/style.css"

However the regfilter is not removing for this and I'm struggling to catch a varnishlog since my filters aren't working

http://www.htpcguides.com/wp-content/plugins/simple-share-buttons-plus/js/ssbp_page.js?ver=4.3.1

I did notice a regex error, it should be -+, however this hasn't changed anything

from libvmod-querystring.

Dridi avatar Dridi commented on June 3, 2024

Can you show me a regfilter example instead? Unlike remove that is quite straightforward, regfilter can be tricky.

from libvmod-querystring.

blindpet avatar blindpet commented on June 3, 2024

That's the thing, there seems to be nothing done to .js files

31 RxURL        c /wp-content/themes/generatepress/js/superfish.min.js?ver=1.3.19
 31 RxProtocol   c HTTP/1.1
 31 RxHeader     c Host: www.htpcguides.com

from libvmod-querystring.

blindpet avatar blindpet commented on June 3, 2024

Finally found one

VCL_call     c vmod_regfilter("/?sccss=1&ver=4.3.1", "(\?|\&)ver\=.+") "/?sccss=1&ver=4.3.1"

and this, I do realize the regex needs to be tweaked for this (this (?|&)v(er)?=.+ will match it)

 20 VCL_call     c vmod_regfilter("/wp-content/themes/generatepress/fonts/fontawesome-webfont.woff2?v=4.4.0", "(\?|\&)ver\=.+") "/wp-content/themes/generatepress/fonts/fontawesome-webfont.woff2?v=4.4.0"

from libvmod-querystring.

Dridi avatar Dridi commented on June 3, 2024

This issue just timed out. Feel free to reopen it if you still have issues.

from libvmod-querystring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.