Forward Subdomain to URL

Hey Cloudflare, I’m looking to forward dev-tools.nick.me to the following URL: https://docs.google.com/spreadsheets/d/15HN62W

I’m on the Redirect Rules page. I name the rule…

Under If… I’m assuming I select “Custom filter expression”.

Under “When incoming requests match…” what do I set for the Field, Operator, and Value?

Thank you,

Nick

Hi,

If all requests to that domain are to be redirected, you can use:

Field: Hostname 
Operator: equals 
Value: dev-tools.nick.me
2 Likes

Hello what other settings did you use to redirect your subdomain to the google sheet?

I am trying to do the same thing but to a google form

so far I got a new domain. created a cname for the subdomain

in redirect rules I have

Field: Hostname 
Operator: equals 
Value: dev-tools.nick.me

then

Type: Static
URL: google form url
Status code: 301
Preserver query string: checked

but so far its not working

This did not work for me either.

I am attempting to follow the documentation:
https://developers.cloudflare.com/rules/url-forwarding/single-redirects/create-dashboard/
and
https://developers.cloudflare.com/rules/url-forwarding/single-redirects/settings/

But as of 10/23 both are very vague and offer no details.

I have a ticket open with Cloudflare. If they happen to reply to my ticket with a fix I will post the correct settings here.

The redirect-from domain must be proxied :orange: by Cloudflare.

1 Like

Thank you, I tried the URL this morning and now it is working, I guess it just needed some time

I made a cname record last night for my subdomain and had that proxied and now after some time it is working

1 Like

When I try to add a CNAME adding a URL in the Target field I get the following error and does not create the CNAME.

DNS Validation Error (Code: 1004) Content for CNAME record is invalid.

The target field is not for URLs. It is for hostnames. A CNAME record creates an alias of a canonical hostname.

You can think of Bill Smith as an alias of the canonical name William Smith. They are different names that refer to the same person. That’s how a CNAME record works. It’s just another name. It is not a redirect. It also only works if the canonical name knows about the alias. If William doesn’t know he is supposed to answer to Bill, the alis isn’t very useful.

If your goal is to make a hostname lead to a particular page or path below another hostname, you will need to use a redirect. Try some of these examples.

I do thank everyone for their tips. Whilst I’m sure there is validity to everything mentioned here I am still lost. If someone could dumb this way way way down for me that would be great - OK, thanks!

I am looking to do nothing else besides I want to be able to open a web browser and type dev-tools.nick.me into the URL bar and it takes me to https://docs.google.com/spreadsheets/d/15HN62W

I’m on the Redirect Rules page. Under “Create new Dynamic Redirect”

For If… do I select “All incoming requests” or “Custom filter expression” radio button?

Assuming I use “Custom filter expression”…

When incoming requests match…
What do I select for “Field”?
What do I select for “Operator”?
What to I enter for “Value”

Then…
What do I pick for “Type”?
What do I put for “URL”?
Status Code = 302
Do I check the “Preserve query string” checkbox?

so for the cname I used it to make a subdomain
so for my google form I am trying to update it is an rsvp

so for the name I put rsvp and for the target I put @ so it points at my domain, then I left the orange cloud on so it is proxied by cloudflare

this will give me the subdomain of rsvp.mydomain.com

now when I made the redirect rule I made it a custom filter
field: hostname
operator: equals
value: rsvp.mydomain.com

then for the url redirect I put
type: static
URL: the link to my google form
status code: 301
and I checked the box for preserve query string

Im no expert but after setting it up like this and going to sleep I woke up to it working and I didnt want to mess with it now that it works

1 Like

Thank you for the reply, I tried this waiting overnight. This is sill not working for me.

To follow up on this after further troubleshooting with Cloudflare support… Cloudflare was paused on my domain, this is why even if I had the correct settings they were not working as Cloudflare was paused on my domain.

For anyone looking to Forward a Subdomain to a URL these are the steps I used as of October 2023. In the example below I will Forward sub.doamin.com to https://google.com

*Note: verify Cloudflare is not paused on your domain. (Overview page, lower right under “Advanced Actions”)

Step1 - Create DNS Record
Type: CNAME
Name: sub
Target: domain.com
Proxy status: Proxied
TTL: Auto

Step2 - Create Redirect Rule
Under “Create new Dynamic Redirect”

For “Rule name” name your rule whatever you would like it named.

If…: Custom filter expression
Field: Hostname
Operator: equals
Value: sub.doamin.com

Then…
Type: Static
URL: https://google.com
Status Code = 301
Check the “Preserve query string” checkbox.

2 Likes

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