Skip to content

Instantly share code, notes, and snippets.

@ShadowJonathan
Created March 24, 2024 12:24
Show Gist options
  • Save ShadowJonathan/44d1cb7a24ae5e80b67472c86fd42d65 to your computer and use it in GitHub Desktop.
Save ShadowJonathan/44d1cb7a24ae5e80b67472c86fd42d65 to your computer and use it in GitHub Desktop.
mastodon user federation request prioritisation
map $request_uri $ap_resource_user {
~^/@(\w+)$ $1;
~^/@(\w+)/\d+$ $1;
~^/users/(\w+)$ $1;
~^/users/(\w+)/\w+$ $1;
~^/users/(\w+)/statuses/\d+$ $1;
default "";
}
lua_shared_dict your_dict_name 10m;
server {
# ...
set_by_lua_file $lua_prioritized /etc/nginx/lua/user_link_resolve_prio.lua your_dict_name;
# ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment