DerZade
DerZade
Explore posts from servers
CDCloudflare Developers
Created by DerZade on 4/25/2024 in #workers-help
Redirect Pages Request to Worker only if header is set
Hey, Is there any way to redirect some request that are usually served by Pages to a Worker. I would like to select those request depending on if a HTTP header has a specific value. I know I could use Worker Routes, but that would mean that all request would hit the worker, not only request with that header, which would be overkill since only a minority of request will actually include the header. In the best case it should not do an actual redirect, but just handle the request differently on the server side. Thanks a lot in advance!
3 replies
CDCloudflare Developers
Created by DerZade on 2/12/2023 in #workers-help
Disable routes in wrangler.toml
I have a worker that should only be accessible as a service binding and not via Routes or Custom Domains. I know that I can disable the default route in the dashboard, but as soon as I publish the worker via wrangler the default route is enabled again. https://i.imgur.com/oh7qHHj.png I guess that this is due to the default wrangler config. I couldn't find anything in the docs, how to disable routes entirely in the wrangler.toml (https://developers.cloudflare.com/workers/platform/triggers/routes/#matching-behavior) I already tried to set the routes to an empty array like this:
routes = []
routes = []
but didn't have any success with that. Is this even possible, or are the worker services simply too new so that it is not intended to have no triggers? Thanks in advance!
4 replies