Page Rule Forwarding Subdomain To Specific Port with Wildcard

I have followed the instructions at but there appears to be a wrinkle in what I am trying to do.

I want traffic that comes in to to be routed to I have that working just fine. Thanks to the various helps from this community.

However, I cannot take in any variables to that redirect.

I looked over this article, , and it appears that is what I want, but I keep getting an error:
Page Rule validation failed: See messages for details. (Code: 1004)

My settings for the rule are:
Forwarding URL 302$1

That produces the 1004 error.

If I remove the /$1 it works just fine.

Is this a limitation of the free plan? If so, what must I upgrade to make it work?

Any help would be appreciated. Thanks!


Thanks to Discourse formatting, a * turns the text into italics.

If my hunch is correct, you have a leading * for the Match as well as a trailing *. $1 matches the first wildcard, so you need to use $2 instead to match the trailing wildcard.

The $2 produces the same error 1004.

Thank you though, I should have tried that already.

How about adding Port 443 to the Match URL?

I tried having more than one page rule to accomplish what you are suggesting, but it failed too. The issue is that I want all traffic to come to port 8443, not just stuff that arrives on SSL already. I am not sure that I can accomplish what I want on just the DNS level, I might have to do some juggling on my server too.

If you already enabled “Always Use HTTPS” for your zone…I think that will happen before Page Rules are executed.

I tried 3 different ways.

I tried the always rule, I have put that in place for other sites before.

I tried manually doing that too, basically just manually writing the https into a forward.

I have tried arranging the page rules too, seeing if that would affect it.

I am not sure that I can do it in Cloudflare only, I am not upset about this, just trying to figure the way to do it with the fastest result.

Thanks again for your help.


I appreciate your help, I am going to move this over to Cloudflare support and see if I can get an answer there. I will post the results here in case anyone else is looking for this.

I think mine is working:

iRetina:~ scott$ curl -I
HTTP/2 301
date: Sat, 09 Feb 2019 17:37:20 GMT
cache-control: max-age=3600
expires: Sat, 09 Feb 2019 18:37:20 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
expect-ct: max-age=604800, report-uri=""
server: Cloudflare
cf-ray: 4a681a77ce42540e-LAX

I believe the underlying issue is that Cloudflare believes to recognise a possible redirection loop, because it does not take into account the port number in the redirection URL.

The message in the returned error is clear on that


So I believe it is not even about having or not having the variable but the issue is simply the hostname.

This topic was automatically closed after 31 days. New replies are no longer allowed.