diff --git a/conf/nginx.conf b/conf/nginx.conf index 1ec7d21..2ea6460 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,3 +1,5 @@ +#https://github.com/LemmyNet/lemmy-ansible/blob/main/templates/nginx_internal.conf + #limit_req_zone $binary_remote_addr zone=lemmy_ratelimit:10m rate=1r/s; # Only connect to this site via HTTPS for the two years @@ -19,7 +21,11 @@ location / { # lemmy_port: 8536 set $proxpass "http://127.0.0.1:__PORT_UI__"; - if ($http_accept ~ "^application/.*$") { + + if ($http_accept ~ "^application/activity+json") { + set $proxpass "http://127.0.0.1:__PORT__"; + } + if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") { set $proxpass "http://127.0.0.1:__PORT__"; } if ($request_method = POST) { @@ -28,7 +34,6 @@ location / { proxy_pass $proxpass; rewrite ^(.+)/+$ $1 permanent; - # Send actual client IP upstream proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; @@ -42,10 +47,7 @@ location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - # Rate limit - # limit_req zone=lemmy_ratelimit burst=30 nodelay; - - # Add IP forwarding headers + # Send actual client IP upstream proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/manifest.toml b/manifest.toml index 0155ebf..4ed7666 100644 --- a/manifest.toml +++ b/manifest.toml @@ -51,7 +51,7 @@ ram.runtime = "50M" [resources.ports] main.default = 8536 - ui.default = 8537 + ui.default = 1235 [resources.system_user]