Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecddc080 authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

Add rate limit config in nginx about search endpoints

Close: #33
parent bac54536
Loading
Loading
Loading
Loading
+11 −6
Original line number Original line Diff line number Diff line
limit_req_zone $http_x_forwarded_for zone=botlimit:10m rate=3r/s;

server {
server {
  listen 80;
  listen 80;
  server_name _;
  server_name _;
@@ -11,15 +13,18 @@ server {


  root /var/www/spot;
  root /var/www/spot;


  location = / {
    limit_req zone=botlimit burst=3;
    include /etc/nginx/proxy_spot_params;
  }
  location = /search {
    limit_req zone=botlimit burst=3;
    include /etc/nginx/proxy_spot_params;
  }
  location / {
  location / {
    try_files $uri @searx;
    try_files $uri @searx;
  }
  }

  location @searx {
  location @searx {
    proxy_pass http://spot:80;
    include /etc/nginx/proxy_spot_params;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffering off;
  }
  }
}
}
+5 −0
Original line number Original line Diff line number Diff line
proxy_pass http://spot:80;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
+2 −0
Original line number Original line Diff line number Diff line
FROM nginx:1.17.6-alpine
FROM nginx:1.17.6-alpine


COPY etc/nginx/conf.d/spot.conf /etc/nginx/conf.d/default.conf
COPY etc/nginx/conf.d/spot.conf /etc/nginx/conf.d/default.conf
COPY etc/nginx/proxy_spot_params /etc/nginx/proxy_spot_params
RUN sed -i 's!remote_addr!http_x_forwarded_for!g' /etc/nginx/nginx.conf
COPY --chown=nginx:nginx searx/static /var/www/spot/static
COPY --chown=nginx:nginx searx/static /var/www/spot/static