Bulk redirects with subdomain

Hi,

Attempting to redirect app.ourdomain.ca to app.ourdomain.com while preserving subpaths and query strings. Followed the instructions given by Cloudflare and just added the subdomain to the front but nothing is redirecting. Is there something different that needs to be done for subdomains?

The settings look like the following:
In the bulk redirect list
Source URL: app.ourdomain.ca/
Target URL: https://app.ourdomain.com
Status: 301
Parameters: Preserve Query String & Subpath matching are checked

The proxy status for app.ourdomain.com is set to DNS only, would that be the issue? Or does bulk redirects not handle subdomains as the source URL?

You seem to be on the right track here. :slight_smile:

In order for any Cloudflare functionality (DDoS protection, WAF/Firewall rules, Redirect rules, Caching, …) to take effect, the DNS record must indeed be Proxied (:orange:).

1 Like

Thanks for the confirmation, that solved the problem of them not working at all.

Are there known issues with subdomains redirecting to domains and keeping the subpaths/query strings?

I have tried both

  • Redirecting with the settings shown above
    and
  • Changing target URL to https://ourdomain.com

Neither one keeps the subpaths. It always just redirects to the main domain.

When I enter app.ourdomain.ca/somepath it always redirects to either app.ourdomain.com or ourdomain.com

If you require that /somepath to be a part of the address on the final destination, you might want to flip the check mark on to “Preserve path suffix” too?

Here’s the respective results that I’m getting, by following your advice:

Source URL: https://app.cheeseburger.test/
Target URL: https://app.example.invalid
Status: 301
Parameters: Preserve query string, Subpath matching

$ curl -s -D - -o /dev/null "https://app.cheeseburger.test/?spaghetti=n&cheeseburger=y"
HTTP/2 301
location: https://app.example.invalid?spaghetti=n&cheeseburger=y
$ curl -s -D - -o /dev/null "https://app.cheeseburger.test/somepath?spaghetti=n&cheeseburger=y"
HTTP/2 301
location: https://app.example.invalid?spaghetti=n&cheeseburger=y

And here’s the respective results that I’m getting, with “Preserve path suffix” enabled:

Source URL: https://app.cheeseburger.test/
Target URL: https://app.example.invalid
Status: 301
Parameters: Preserve query string, Subpath matching, Preserve path suffix

$ curl -s -D - -o /dev/null "https://app.cheeseburger.test/?spaghetti=n&cheeseburger=y"
HTTP/2 301
location: https://app.example.invalid?spaghetti=n&cheeseburger=y
$ curl -s -D - -o /dev/null "https://app.cheeseburger.test/somepath?spaghetti=n&cheeseburger=y"
HTTP/2 301
location: https://app.example.invalid/somepath?spaghetti=n&cheeseburger=y