What URI paths does lemmy federation use?
from ssnoer@indie-ver.se to selfhosted@lemmy.world on 05 Feb 16:48
https://indie-ver.se/post/20216

cross-posted from: indie-ver.se/post/20213

Hi again!

I am trying to improve the security for my website, but I am unsure of which paths federation and API traffic hits, and which paths should be exempt from e.g. Javascript challenges? Could somebody give me some insight into this?

#selfhosted

threaded - newest

ptz@dubvee.org on 05 Feb 16:55 next collapse

Basically the only thing you want to present with a challenge is the paths/virtual hosts for the web frontends.

Anything /api/v3/ is client-to-server API (i.e. how your client talk to your instance) and needs to be obstruction-free. Otherwise, clients/apps won’t be able to use the API. Same for /pictrs since that proxies through Lemmy and is a de-facto API endpoint (even though it’s a separate component).

Federation traffic also needs to be exempt, but it’s not based on routes but by the HTTP Accept request header and request method.

Looking at the Nginx proxy config, there’s this mapping which tells Nginx how to route inbound requests:

nginx_internal.conf: raw.githubusercontent.com/…/nginx_internal.conf

    map "$request_method:$http_accept" $proxpass {
        # If no explicit matches exists below, send traffic to lemmy-ui
        default "http://lemmy-ui:1234/";

        # GET/HEAD requests that accepts ActivityPub or Linked Data JSON should go to lemmy.
        #
        # These requests are used by Mastodon and other fediverse instances to look up profile information,
        # discover site information and so on.
        "~^(?:GET|HEAD):.*?application\/(?:activity|ld)\+json" "http://lemmy:8536/";

        # All non-GET/HEAD requests should go to lemmy
        #
        # Rather than calling out POST, PUT, DELETE, PATCH, CONNECT and all the verbs manually
        # we simply negate the GET|HEAD pattern from above and accept all possibly $http_accept values
        "~^(?!(GET|HEAD)).*:" "http://lemmy:8536/";
ssnoer@indie-ver.se on 05 Feb 17:02 collapse

This is very useful. Thanks!

EarMaster@lemmy.world on 05 Feb 17:58 collapse

activitypub.rocks