]> Untitled Git - lemmy.git/commitdiff
Disable rate limiting for pictrs
authorFelix Ableitner <me@nutomic.com>
Fri, 7 Aug 2020 14:24:26 +0000 (16:24 +0200)
committerFelix Ableitner <me@nutomic.com>
Mon, 10 Aug 2020 12:19:53 +0000 (14:19 +0200)
ansible/templates/nginx.conf

index 092f855203ad8951d1fa877a7d4985cfd058646f..886ce0b78bfb8f771382d976ceda3cb5bfe48d68 100644 (file)
@@ -51,9 +51,6 @@ server {
     # Upload limit for pictrs
     client_max_body_size 20M;
 
-    # Rate limit
-    limit_req zone=lemmy_ratelimit burst=30 nodelay;
-
     location / {
         proxy_pass http://0.0.0.0:8536;
         proxy_set_header X-Real-IP $remote_addr;
@@ -67,6 +64,9 @@ server {
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
+
+        # Rate limit
+        limit_req zone=lemmy_ratelimit burst=30 nodelay;
     }    
 
     # Redirect pictshare images to pictrs
@@ -74,6 +74,14 @@ server {
       return 301 /pictrs/image/$1;
     }
 
+    # Separate location block to disable rate limiting for images
+    location /pictrs {
+      proxy_pass http://0.0.0.0:8536/pictrs;
+      proxy_set_header X-Real-IP $remote_addr;
+      proxy_set_header Host $host;
+      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    }
+
     location /iframely/ {
       proxy_pass http://0.0.0.0:8061/;
       proxy_set_header X-Real-IP $remote_addr;