I’m trying to append a random string to the end of URLs with a set of paths and would like to know the expression to use for the dynamic query rewrite.
You’ll need to use a concat() operator, e.g. concat(http.request.uri.path,"/","1234567") will result in requests to /path/ being rewritten to /path/1234567.
I apologize, but it is still not clear to me whether if you want to rewrite the path or the query and whether you want to replace or append. Could you tell which of the examples below describe what is is you want to achieve? Then I can post the solution
Thank you. It’s the last one I’m looking for – query append. When I used concat(http.request.uri.query, cf.ray_id) – it appended the cfid – but it did it twice. It repeats the cfid in the rewritten URL.
This should do query append. However, if the original query is empty, the rewritten query will end up ?&6d6c461d3222f019-EWR - there’s currently no way to avoid the ampersand afaik. Though most URL parsers should just ignore the empty parameter, so I suspect it won’t cause any issues.