w3c / websub

WebSub Spec in Social Web Working Group
https://w3c.github.io/websub/
287 stars 51 forks source link

Redirections during (un)subscription POSTs to a hub #73

Closed tonyg closed 7 years ago

tonyg commented 7 years ago

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.

aaronpk commented 7 years ago

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?

tonyg commented 7 years ago

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.

azaroth42 commented 7 years ago

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?

julien51 commented 7 years ago

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.

azaroth42 commented 7 years ago

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

julien51 commented 7 years ago

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

azaroth42 commented 7 years ago

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.

aaronpk commented 7 years ago

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.

julien51 commented 7 years ago

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

aaronpk commented 7 years ago

@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

azaroth42 commented 7 years ago

:+1: to allowing 307,308 Thanks for being open here!

tonyg commented 7 years ago

:thumbsup: Looks good to me! Thanks, @aaronpk.