You’ll probably get better help from there. I’ve not used the plugin, the author will probably be the best person to help.
It would probably be helpful if you can show example requests with curl -v and an example of what the response body looks like that you’re trying to replace. You might want to enable the debug global option in case the plugin has additional logging that would help show what’s going on.
Thank you for the answer. I don’t receive any reply from GitHub…
I tried the debug mode but there are no error logs that could help me to solve the issue.
I have an XML file and with Caddy, I would like to replace some strings. So, the filter code should search the word “test”, and replace it with {http.request.orig_uri.query}, but I would like to insert the condition that the value of {http.request.orig_uri.query} must be a GUID (e.g. to avoid XML injection).
{http.request.orig_uri.query} is the URL value after the ? character.
Might be worth trying to checkout the plugin and add debug statements to the code yourself to find the issue. You can build the plugin from your local checkout using xcaddy, see the README on the xcaddy project’s GitHub page which explains how to replace the module with a local copy. You can add fmt.Printf("\n%+v\n", someVariable) throughout to get it to spit out some data to stdout at runtime.
Hi! I’m trying the expressions but can’t get them to work…I need to check 3 different queries, but they could be present or not in the URL…could you check this code, please?
@query `!{http.request.orig_uri.query}.matches("^\\s*$")` //check if there is the query in url
@string1-not-match `!{http.request.uri.query.string1}.matches("^(.*\\.google\\.com$")`
@string2-not-match `!{http.request.uri.query.string2}.matches("^.*\\b[a-zA-Z0-9]{32}\\b$")`
@string3-not-match `!{http.request.uri.query.string3}.matches("^.*\\b[a-zA-Z0-9]{32}\\b$")`
@match expression `{string1-not-match} || {string2-not-match} || {string3-not-match}`
handle @query {
respond @match 404
}
I have this error in logs:
logger":“http.matchers.expression”,“msg”:“evaluating expression”,“error”:“no such overload”