Add OpenGraph card previews for Mattermost link unfurling#19
Closed
raheelkhan wants to merge 2 commits intomainfrom
Closed
Add OpenGraph card previews for Mattermost link unfurling#19raheelkhan wants to merge 2 commits intomainfrom
raheelkhan wants to merge 2 commits intomainfrom
Conversation
Mattermost link previews need OG meta tags, but card pages require auth. This serves minimal OG HTML to unauthenticated requests from the VPC CIDR, enabling Mattermost to unfurl card links with title/description/image. Also adds justfile and infra scripts matching nexus patterns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
Unnecessary complex. Closing this. Better to have the plugin talks to Fizzy with Bearer Token. |
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.
Summary
Enables Mattermost to show rich link previews when someone posts a Fizzy card URL. Since Fizzy requires authentication, Mattermost's server-side link fetcher was hitting the login page and getting no OG meta tags.
Solution: For unauthenticated requests from trusted VPC IPs,
CardsController#showserves a minimal HTML page with just OpenGraph meta tags (title, description, image). Authenticated users and requests from outside the VPC get the normal behavior.Changes
app/controllers/concerns/opengraph_preview.rb— Concern that checksrequest.remote_ipagainst CIDRs inOPENGRAPH_TRUSTED_CIDRSenv varapp/controllers/cards_controller.rb—showaction skips auth for trusted IPs, serves OG-only HTML responseapp/views/cards/opengraph.html.erb— Minimal HTML withog:title,og:description,og:image,og:urlmeta tags (reuses existingcard_social_tagshelper)infra/lib/constructs/service.ts— InjectsOPENGRAPH_TRUSTED_CIDRSfromvpc.vpcCidrBlock(resolves to10.1.0.0/16)infra/cdk.context.json— Added Production VPC context cachejustfile+infra/scripts/— CDK wrapper scripts and justfile matching nexus infra patternsHow it works
https://fizzy.zarhq.dev/0000001/cards/316)request.remote_ipagainstOPENGRAPH_TRUSTED_CIDRSSecurity
Test plan
OPENGRAPH_TRUSTED_CIDRSis set to10.1.0.0/16in task definitioncurla card URL without auth and confirm OG meta tags are returned🤖 Generated with Claude Code