That sounds ominous. How did you disable uploads? I'm worried for my own instance ๐
this post was submitted on 21 Jun 2023
2 points (100.0% liked)
Dubvee Meta
96 readers
3 users here now
Announcements and meta discussions about the DubVee instance.
founded 1 year ago
MODERATORS
I am doing it through Nginx.
The original backend location
block is this:
location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
I removed pictrs
from that so it's now this:
location ~ ^/(api|feeds|nodeinfo|.well-known) {
Then I created a new location block just for pictrs where I do some extra stuff:
location ^~ /pictrs {
# Deny uploads
if ($request_method ~ ^(POST)$ ) {
return 444;
}
proxy_cache imgcache;
proxy_cache_valid any 72h;
add_header X-Proxy-Cache $upstream_cache_status;
add_header X-Content-Type-Options "nosniff";
add_header X-Frame-Options "DENY";
add_header X-XSS-Protection "1; mode=block";
proxy_pass "http://lemmyBE";
# Set standardized headers to send to backend server
include conf.d/includes/proxy.conf;
}
The if
block checking the $request_method
denies any POST from the frontend to anything under /pictrs
which effectively disables all user uploads. Lemmy backend is still able to use the pictrs service to generate thumnbails, though. However, that is fine. The proxy_cache
stuff has a few extra directives outside the server block and caches image responses for 72 hours.
view more: next โบ