Sharing urls on social media - trailing `@` ignored breaking the display
Hey everyone, Manon told me it could be useful to share this, so here I am
Through deployments i've noticed that some social media platforms, like Facebook, ignore the trailing @
of resource urls, in which case the page of the resource just appears blank.
Image of the break, in case I fix it by the time you read this
For Risefor I implemented this piece of code within the nginx conf file of our auto-deployment script which solves the issue by redirecting the traffic to the right url
#########
# Social media share issue - platforms ignore trailing "@" and/or "/@" in URL, which breaks loading
#########
# if action url is missing '@' at end
location ~ /actions/action-group-detail/.*/(\d+\/$) {
return 301 https://$host$request_uri_path@;
}
# if action url is missing '/@' at end
location ~ /actions/action-group-detail/.*/(\d+$) {
return 301 https://$host$request_uri_path/@;
}
The two routes, /actions/action-group-detail/
, would have to be changed depending on the instance's url structure, but apart from that it should be functional