How to forward URL and preserve query params

I’m using page rules to forward a URL. It works fine for a simple case, but when I need to also forward the query params it fails. Support team keeps sending me documentation that does not answer the question (ex. Understanding and Configuring Cloudflare Page Rules (Page Rules Tutorial) – Cloudflare Help Center) or is for a completely different problem (Understanding Query String Sort – Cloudflare Help Center). I don’t care about caching. Just need to forward a url with the query params. How are other people solving this problem?

Can you share what your Page Rule currently looks like? Query params work fine using parameters like this:

% curl "https://communitymvp.cf/redirect/test?query=parameter" --dump-header - --silent  | grep location
location: https://community.cloudflare.com/test?query=parameter
3 Likes

Dude! That worked. Thanks Michael!

for other folks that may run into this problem, here is what my URL looks like: https://mydomain/path1?param1=x&param2=5, and I need that forwarded to https://mydomain/path2?param1=x&param2=5
so my rule is:
forward from https://mydomain/path1?*
to https://mydomain/path2?$1

and it includes all of the query params.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.