diff --git a/infra.yaml b/infra.yaml index b6d6229..29fa203 100644 --- a/infra.yaml +++ b/infra.yaml @@ -210,6 +210,7 @@ Resources: FunctionCode: !Sub | const needsIndexHtmlRe = /(\/[^\/.]+)\/*$/ const penumbraJournalRedirectRe = /^\/penumbra\/journal\/00[1-5]-/ + const mastodonProfileRedirectRe = /^\/@eric\/?/ function handler(event) { const request = event.request @@ -239,6 +240,18 @@ Resources: } } + if (mastodonProfileRedirectRe.test(request.uri)) { + return { + statusCode: 302, + statusDescription: 'Found', + headers: { + location: { + value: 'https://mastodon.limulus.net' + request.uri + } + } + } + } + request.uri = request.uri.replace(needsIndexHtmlRe, '$1/index.html') return request }