Firefox 网络推送 "Invalid URL endpoint"

Firefox web push "Invalid URL endpoint"

我尝试将 webpush 发送到 firefox

curl -i -X PUT https://updates.push.services.mozilla.com/push/gAAAAABW5EzHyop8VZSH2jm9LJ7W8ybH3ISlbZHDGnd4RwW7h2Jb0IGTuSsP2BCoBxl0kJp-kXXL164xNzhxkTEztP1-IqVf9040VOEuy_htb1nnp-24W-RGgWgjtGK1kZYAb1k3xmAS
HTTP/1.1 400 Bad Request
Access-Control-Allow-Headers: content-encoding,encryption,crypto-key,ttl,encryption-key,content-type,authorization
Access-Control-Allow-Methods: POST,PUT
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: location,www-authenticate
Content-Type: application/json
Date: Tue, 15 Mar 2016 13:04:44 GMT
Server: cyclone/1.1
Content-Length: 51
Connection: keep-alive

{"errno": 102, "code": 400, "error": "Bad Request"}

这是否意味着我的数据库中存储了无效的注册 ID,我应该将其删除?

端点 URL 似乎无效,它通常类似于 https://updates.push.services.mozilla.com/push/v1/SOME_LONG_ID(请注意 v1 而您的 URL t 包含)。

的确,这有效: curl -i -X PUT https://updates.push.services.mozilla.com/push/v1/gAAAAABW5EzHyop8VZSH2jm9LJ7W8ybH3ISlbZHDGnd4RwW7h2Jb0IGTuSsP2BCoBxl0kJp-kXXL164xNzhxkTEztP1-IqVf9040VOEuy_htb1nnp-24W-RGgWgjtGK1kZYAb1k3xmAS

请注意,您可能需要添加 TTL header,否则您的请求可能会失败(您只需要 -H "TTL: 60"):https://blog.mozilla.org/services/2016/02/20/webpushs-new-requirement-ttl-header/.