Send a User-Agent from the HTTP client (fixes Dev.to edge 403) - #9
Merged
Merged
Conversation
PHP's curl sends no User-Agent by default, and Dev.to's edge (Varnish) answers a no-UA request with an empty-bodied HTTP 403 before it reaches the Forem API. That, not the post body, was failing every syndication: proven server-side, the same GET returns 403 with no UA and 200 with any UA. CurlHttpClient now sends a descriptive User-Agent (overridable), which also benefits Hashnode. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The plugin's
CurlHttpClientset noUser-Agent. PHP's curl sends none by default, and Dev.to's edge (Varnish) answers a no-UA request with an empty-bodied HTTP 403 before it ever reaches the Forem API. That is what was failing everyblog_syndicate_post(external_id null every time), and why the error carried no upstream text (the empty body was the edge's, not Forem's).Proven server-side against
GET /api/users/mewith the live key, from the danmat container:Not the SVG (outbound body is clean markdown), not the key (valid, correct account), not a publish gate (a manual publish did not help, because the request never reached the API).
Fix
CurlHttpClientnow sends a descriptiveUser-Agent(NimbusCMS-Blog/1.0, overridable). This also benefits Hashnode, which shares the client.🤖 Generated with Claude Code