I have updated the example Nginx configuration as suggested to only send full specified at-proto
requests to my new API, all others go to user profile.
- <user-slug>.example.com --> example.com/u/<user-slug>
- <user-slug>.example.com/.well-known/atproto-did --> example.com/api/bluesky/<user-slug>
This example also passes on any provide path, which means users can use subdomain as a vanity URL to do things like
- <user-slug>.example.com/. (posts by default)
- <user-slug>.example.com/discussions
- <user-slug>.example.com/likes
- <user-slug>.example.com/masquerade
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
# listen for any subdomains EXCEPT known ones...
server_name ~^(?<slug>(?!other-suddomain-to-exclude)\w+)\.example\.com$;
if ( $request_uri ~ ^/.well-known/atproto-did ) {
# send atproto did verification requests to custom endpoint
return $scheme://example.com/api/bluesky/$slug;
}
# send all other requests to subpath of user profile
return $scheme://example.com/u/$slug$request_uri;
...
}
I started going down the path of adding a custom controller for the .well-known/atproto
url but this seemed more simply handled at webserver layer.