Rewrite, not Redirect certain URL

I have Cloudflare redirect/cache all requests:

https://domain.no -> https://www.domain.no

Now, apple requires (https://developer.apple.com/forums/thread/106872) that the applinks descriptor file (.well-known/apple-app-site-association) to NOT redirect with 301

real url should stay without “www.” added: https://domain.no/.well-known/apple-app-site-association

I’ve tried adding full URI matches to Page rules, Rewrite rules, Cache rules… all end up with

Connecting to domain.no…|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: `https://www.domain.no/.well-known/apple-app-site-association` [following]

What I’m looking for is a Rewrite, not a Redirect. Not sure if that’s doable though?

Based on your description, it sounds to me like exempting that specific URL from your existing redirect might be another option, as long as your origin will serve that request.

Where is your current example.comwww.example.com redirect configured?
Is it in Cloudflare or at your origin server?

It might be possible using Transform Rules.

Thanks! Very good question - maybe I’m redirecting before Cloudflare… Didn’t think of that, I’ll check!

1 Like

Or after, depending on your perspective. :wink:

Let us know what you find and how you wind up achieving the result that you need.

@epic.network yeah I think that was it - seems the origin server was setup to redirect domain.no to www.domain.no actually

so that would have been

GET domain.no → cloudflare → origin server → 301 www.
GET domain.no → cloudflare → origin server → proper response

From what I can see from history, this has something to do with a wordpress bug/feature related to www
But we use next instead of wordpress now, and I don’t like www. anyway so it’s definitely gone from everywhere

1 Like

hm can’t find the edit button

so flow was:

GET domain.no → cloudflare → origin server → 301 www.
GET www.domain.no → cloudflare → origin server → proper response

Keywords are Cloudflare assetlinks apple .well-known apple-app-site-association redirect and Dreamhost by the way (for google to pick up this :wink:

1 Like

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