Skip to content

Instantly share code, notes, and snippets.

@baskaran-md
Created September 2, 2014 20:20
Show Gist options
  • Select an option

  • Save baskaran-md/e46cc25ccfac83f153bb to your computer and use it in GitHub Desktop.

Select an option

Save baskaran-md/e46cc25ccfac83f153bb to your computer and use it in GitHub Desktop.
NginX allow POST on static pages.
# ...
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 404 /404.html;
error_page 403 /403.html;
# To allow POST on static pages
error_page 405 =200 $uri;
# ...
}
# ...
@atriciasabino

Copy link
Copy Markdown

I think it would be "index.html", is missing an L. ;)

@jaredmichaelwilliams

Copy link
Copy Markdown

@atriciasabino index.htm isn't missing an L, .htm is a valid filetype.

@mborodov

Copy link
Copy Markdown

Thx very much!

@CanRau

CanRau commented May 19, 2017

Copy link
Copy Markdown

not working for me..what a pitty :/

@sihanwang94

Copy link
Copy Markdown

it works for me perfectly.

@kolayne

kolayne commented Jun 12, 2020

Copy link
Copy Markdown

Doesn't it mean it allows any method? How can I ask Nginx to allow get and post, but forbid others?

@baskaran-md

baskaran-md commented Jun 17, 2020

Copy link
Copy Markdown
Author

@kolayne
You can add this block in the nginx.conf to allow only get & post.

limit_except GET POST { 
    deny  all; 
}

ghost commented Dec 1, 2020

Copy link
Copy Markdown

@baskaran-md
access_log $request_body is null

@ivantchomgue

Copy link
Copy Markdown

That works Thanks :)

@rafamdr

rafamdr commented Oct 20, 2024

Copy link
Copy Markdown

That works! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment