Hacker News new | ask | show | jobs
by remline 3190 days ago
How does this deal with proxy loops?

As an example, I would assume worker is making requests with the internal view of the site, but can not have an internal view of other sites or security problems would ensue.. So what happens when two of my sites have service workers fetching something from each other on each request?

1 comments

As you guessed, when your worker makes a subrequest to your own zone, it goes directly to your origin server, but when you subrequest to some other domain, it goes in "the front door", and that other domain's scripts apply.

If a request bounces back such that the same worker script would need to run twice as a result of a single original request, then it fails with an error. There's nothing else we can do here: we can't let the request loop, but we also can't let it skip your script after it's bounced through a third-party script.

To clarify, yesterday you mentioned that subrequests go through the regular caching subsystem.

Does this hold true even for subrequests to your own zone, where you say here that they go directly to the origin server?

Yes. I meant that those requests don't loop back into the Worker again -- I didn't mean that they skip cache.