w3c / websub

WebSub Spec in Social Web Working Group

Home Page:https://w3c.github.io/websub/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redirections during (un)subscription POSTs to a hub

tonyg opened this issue · comments

The spec leaves unsaid how redirections resulting from an (un)subscription POST to a hub are to be treated. Perhaps (un)subscribers SHOULD follow a (small number of) redirections at this point in the protocol? (And hubs SHOULD use codes 307 or 308 to redirect.)

Example use case: sharding based on callback URL. A hub receives a subscription request, determines which hub is responsible for the callback URL supplied in it, and redirects the subscriber to that hub.

It looks to me like the spec explicitly says that hubs must return HTTP 202. https://www.w3.org/TR/websub/#subscription-response-details so this kind of redirection response would not be allowed. The sharding you're talking about could be accomplished by having the hub forward on the subscription request itself to the backend, more like a typical web server load balancer setup. Would that not cover it?

Yes, that would be one way to achieve the effect. It requires quite a bit more machinery on the hub side, of course, but that seems OK.

More broadly, what if the hub moves? Shouldn't a 301 be applicable here? If so, then it seems a bit odd to permit only 301 and not other kinds of redirection.

Making 3XX a failure is, in my opinion, dangerous for sustainability of the service. If a hub or provider changes their infrastructure, they may not have any option but to change links. The rel=hub discovery link might not be easy to update ... meaning that the system would simply fail for no good reason.

Or ... what's the harm in allowing redirection at all stages in the protocol?

I my mind the use of "short" leases is the right solution around this and we should rely on redirects which could have different meanings/reasons to happen.

How would a short lease help you find where to go, if the topic resource has a broken hub link?

Since the lease is short, the subscriber has to perform the whole subscription dance again frequently... and will find the new hub.

if the topic resource has a broken hub link?

E.g. your short lease expires, you go to the topic resource to find the hub, it sends you to the wrong place which can't redirect you anywhere and you fall off the end.

In the history of PubSubHubbub, there hasn't been any actual need for the hub to change its hub URL. The hubs that have been publicly available have been at the same URL for their entire lifetime over many years. This feels like finding a solution to a theoretical problem.

PROPOSAL (aaronpk): add language to make it expliciti that 307/308 are supported and that we hence support hub-redirects
-> resolved

@tonyg we discussed this with the group, and realized that the spec previously didn't explicitly disallow supporting 307/308 redirects, so we decided to make it explicit that it is supported. Please take a look at the new language and close the issue if you're satisfied! Thanks! https://w3c.github.io/websub/#subscription-response-details

👍 to allowing 307,308 Thanks for being open here!

👍 Looks good to me! Thanks, @aaronpk.