Workers + custom route + AAAA = 301 and services can not call webhook exposed by my worker

Hi there! I have a cf worker acting as a webhook to receive inbound email payloads. My inbound email parsing service calls this. Everything was working when I was using the workers dev route.

However, I wanted to add some firewall rules, and to do that I needed to add a custom route, so I can use my custom domain, and therefore make use of cf firewall rules. To add this custom route I followed: https://developers.cloudflare.com/workers/get-started/guide#optional-configure-for-deploying-to-a-registered-domain and setup my worker to serve traffic at inbound.fwd.contact/*

Then, as the guide says, I added an AAAA DNS record, targeting 100::, to make the domain resolve to the worker.

However, what I find is my inbound email parsing provider is no longer calling my webhook, and when I try to curl the route via curl -v https://inbound.fwd.contact/ I get a 301 response. When I try the same URL in the browser, the redirect is followed and the expected response is shown.

I don’t think this 301 is actually correct behavior and I think the AAAA record should just call my worker right? Am I doing this right? Btw, I have https set to strict mode in my cf dashboard for this site.

SOLVED

According to this link https://developers.cloudflare.com/workers/platform/routes#validity routes can specify http, https, or neither. If neither is used, then both are valid. Upon changing my route to only use https, I was able to curl my route directly, no redirect.

Just hypothesizing here, but perhaps the level of https strictness was causing the issue before?

What did it redirect to?

1 Like

I think it was redirecting to the right place (wherever the worker is living), just based on the example I gave from using my browser.

Now if I leave out https in my curl, I get the same redirect, but if I add it I get the expected response. Prior (as in my prior to my SOLVED remark), I was getting a 301 regardless of whether https was present in the URL I was curling or not.

But to be more precise, I don’t exactly know because I didn’t write it down, and now I’m not experiencing the issue.

I can follow up some other time when I have another similar setup and I reach this stage, to try and reproduce the issue.

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