Resolving media access issues with Kavita, NPM, and Authentik integration

Hey everyone, I’m having trouble with my Kavita setup. I’ve got it running behind Authentik and NPM, but there’s a weird issue with the media folder.

When I try to access Kavita, it’s looking for images and fonts in the /media folder. The problem is, it’s only checking Authentik’s media folder, which leads to 404 errors. For example, it’s trying to find stuff like ‘/media/login-bg-3F52TUWZ.jpg’ but coming up empty.

I’ve been digging around in the Authentik settings, but I can’t find a way to change the media folder name. My setup uses Authentik’s Proxy Provider, with the external host set to my Kavita domain and the internal host pointing to the Kavita container.

Has anyone run into this before? Any ideas on how to get Kavita to play nice with Authentik’s media folder? I’m stumped!

I’ve been through this exact headache with Kavita, Authentik, and NPM. What finally worked for me was tweaking the NPM configuration. In the NPM proxy host settings for Kavita, I added a custom location block:

location /media {
    proxy_pass http://kavita-container-ip:port/media;
}

This bypasses Authentik for the media folder, sending requests directly to Kavita. It solved those pesky 404 errors without messing with Authentik’s setup.

Also, make sure your Kavita container has the correct volume mappings for the media folder. I once spent hours troubleshooting only to realize I had a typo in my docker-compose file!

If you’re still stuck, check Kavita’s logs. They often have clues about path issues that aren’t obvious from the browser errors.

hey mate, had the same problem. what fixed it for me was adding a reverse proxy rule in NPM for /media. just point it straight to your kavita container. that way authentik doesn’t mess with those requests. also check ur docker volumes, sometimes thats the culprit. good luck!

I encountered a similar issue when setting up Kavita behind Authentik and NPM. The solution that worked for me was adjusting the Authentik Proxy Provider configuration. In the Proxy Provider settings for Kavita, try adding a custom header. Set the header name to ‘X-Forwarded-Prefix’ and the value to ‘/kavita’ (or whatever path you’re using for Kavita).

This tells Kavita to look for its media files in the correct location. You might also need to update your NPM configuration to ensure it’s properly forwarding the path. In NPM, check that the forward hostname/IP is set correctly and that you’ve enabled ‘Block Common Exploits’ and ‘Websockets Support’.

If you’re still having trouble, double-check your Kavita container’s volume mappings to ensure the media folder is accessible. Sometimes permissions issues can cause similar symptoms.