URL routing infinite redirects

I used URL Routes to map to my workers. The built-in url is showing fine, but the routed path shows the error The page isn’t redirecting properly.

my code:

addEventListener('fetch', event => {
  const key = new URL(event.request.url).pathname.replace(/^\//, '')
  event.respondWith(new Response(key))

What exactly are you trying to achieve?

You’re redirecting infinitely to the same page so it’ll never work.

https://kyg.kr/s/foo is being sent to https://kyg.kr/s/foo is being sent to https://kyg.kr/s/foo, etc

Whatever your origin is behind kyg.kr, aside from the Worker which only runs on /s*, is redirecting HTTPS to HTTP.

curl https://kyg.kr/ -sSI
HTTP/1.1 301 Moved Permanently
Location: http://kyg.kr/

This is an issue with your origin and you’ll need to stop it from trying to send you to HTTP.

kyg.kr/s/foo should display foo.

My origin server doesn’t exist. The IP in the A record is just used as an alias for my server.

The domain isn’t proxied - set it to proxied :orange:

Cloudflare isn’t doing anything on a DNS Only :grey: record, including Workers.

I switched to proxy mode, but the same problem occurs.
It is probably in proxy mode because you can access https://kyg.kr/cdn-cgi/trace.