{"id":948,"date":"2017-01-20T17:26:55","date_gmt":"2017-01-20T17:26:55","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=948"},"modified":"2017-01-20T17:33:45","modified_gmt":"2017-01-20T17:33:45","slug":"adding-http-rate-limits-nginx-example-parse","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2017\/01\/20\/adding-http-rate-limits-nginx-example-parse\/","title":{"rendered":"Adding HTTP Rate Limits in Nginx example for Parse"},"content":{"rendered":"<p>Step 1<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo su -\r\nvi \/etc\/nginx\/conf.d\/yourconfig.conf\r\n\r\nstep 2\r\nlimit_conn_zone $binary_remote_addr zone=concurrent:10m;\r\nlimit_req_zone $binary_remote_addr zone=somefunction:10m rate=1r\/s;\r\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# you don't need this first line bit below, i'm just showing where to put this in nginx config\r\nserver {\r\n\r\n       location \/parse\/functions\/somefunction {\r\n                limit_req zone=somefunction burst=5 nodelay;\r\n                limit_conn concurrent 1;\r\n                proxy_set_header X-Real-IP $remote_addr;\r\n                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n                proxy_set_header X-NginX-Proxy true;\r\n                proxy_pass http:\/\/localhost:1337\/parse\/functions\/sendGift;\r\n                proxy_ssl_session_reuse off;\r\n                proxy_set_header Host $http_host;\r\n                proxy_redirect off;\r\n        }\r\n\r\n# you don't need this bit, i'm just showing where to put this in nginx config\r\n}\r\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nnginx -t\r\nservice nginx restart\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Step 1 sudo su &#8211; vi \/etc\/nginx\/conf.d\/yourconfig.conf step 2 limit_conn_zone $binary_remote_addr zone=concurrent:10m; limit_req_zone $binary_remote_addr zone=somefunction:10m rate=1r\/s; # you don&#8217;t need this first line bit below, i&#8217;m just showing where to put this in nginx config server { location \/parse\/functions\/somefunction { &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2017\/01\/20\/adding-http-rate-limits-nginx-example-parse\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[91,61],"tags":[],"class_list":["post-948","post","type-post","status-publish","format-standard","hentry","category-nginx","category-rackspace"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=948"}],"version-history":[{"count":1,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/948\/revisions"}],"predecessor-version":[{"id":949,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/948\/revisions\/949"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}