Transparent proxy with Workers?


#1

I’m trying to find the best way to transparently send traffic for a specific URL pattern to a different production environment without using page rules and redirects (the traffic is coming from 3rd party incoming webhooks and sometimes won’t follow redirects). Are workers a good candidate for this? I briefly tested this worker pattern for edge proxying, but it turned POST requests into GET requests. Before I dive in, I thought I’d find out if I’m missing something or if any best practices for this had been established. Thanks!


#2

Yes, workers seems to be a good choice for your use case. In the post you linked too, I didn’t handle POST request because that page is expected to receive only GET requests.

You can always check the Request.method

and to make new request,

var myRequest = new Request(url, {method: 'GET'});

#3

Thanks, @jayaprabhakar!

I was hoping for way to avoid checking the request method at all, just a simple pass through. I’ll dig into the docs some more - but do you know if that’s possible off the top of your head?

It looks like the way pattern matching works (a wildcard, no regex) is that I’ll have to check every request. Are there any inefficiencies to be aware of there (other than cost)?

Thanks!!


#4

This topic was automatically closed after 31 days. New replies are no longer allowed.