0

HI i am trying to serve static json files from Nginx. However i want to serve these static files only via POST request and disable the GET calls.

Is there any way to do so.

I refered to this However this looks like a hack and i am looking for some more reliable solution

Community
  • 1
  • 1
Ekansh Rastogi
  • 2,418
  • 2
  • 14
  • 23

1 Answers1

0

Just include the following in your location block for static files:

limit_except POST {
    deny all;
}

This will send a 403 for every request not using POST as HTTP method..

BTW, there are different ways to achieve this, such as CORS, but I think it's out of scope here.

VF_
  • 2,627
  • 17
  • 17