Merge branch 'worker' into 'develop'

Docs: add Soapbox Worker to "Deploy at scale" doc

See merge request soapbox-pub/soapbox-fe!1660
This commit is contained in:
Alex Gleason 2022-07-20 01:54:12 +00:00
commit ea5fb4ec5a

View file

@ -109,17 +109,4 @@ AKA "why don't links to my website show a preview when posted on Facebook/Twitte
Deploying with Nginx means that you forego the link preview functionality offered by Pleroma and Mastodon, since Soapbox has no knowledge of the backend whatsoever.
This problem has no official solution, but we have some ideas:
1. Serve different content to link crawlers based on their `user-agent`.
2. Inject metadata into `index.html` somehow based on the URL.
The first solution is probably the most straightforward, and can be achieved in Nginx like so:
```nginx
if ($http_user_agent ~* "googlebot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp") {
# TODO: route to backend?
}
```
See [this snippet](https://gist.github.com/thoop/8165802) for more information.
Our official solution is [Soapbox Worker](https://gitlab.com/soapbox-pub/soapbox-worker), a Cloudflare Worker that intercepts the reqest/response and injects metadata into the page by querying the API behind the scenes.