# How to respond correctly to a POST request for a static file?

**URL:** <https://www.ruby-forum.com/t/how-to-respond-correctly-to-a-post-request-for-a-static-file/215668>\
**Category:** NGINX\
**Created:** [January 12, 2012, 10:07am UTC](https://www.ruby-forum.com/t/how-to-respond-correctly-to-a-post-request-for-a-static-file/215668 "2012-01-12T10:07:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 12, 2012, 10:07am UTC](https://www.ruby-forum.com/t/how-to-respond-correctly-to-a-post-request-for-a-static-file/215668/1 "2012-01-12T10:07:35Z")

</div>

hi,

I have a Facebook app hosted on nginx. Faceboook fetches the data by  
issuing a POST request for index.html before embedding it in their  
canvas. My server replies with 404, instead of the expected 405. If it  
was 405, I could fix things by adding “error\_page 405 =200 $uri;” to the  
configuration file, but for some reason it’s 404.

I can think of two ways of correcting the situation:

1. Find a way to have the server respond with 405 and then add the above  
line. This is probably the correct way.
2. Respond with 200 when a POST request is issued for index.html.

How do I implement either one of these?

thanks,  
Johnny.

Posted at Nginx Forum:

> **[How to respond correctly to a POST request for a static file?](https://forum.nginx.org/read.php?2,221059,221059#msg-221059)**
>
> hi, I have a Facebook app hosted on nginx. Faceboook fetches the data by issuing a POST request for index.html before embedding it in their canvas. My server replies with 404, instead of the expected 405. If it was 405, I could fix things by adding...

---

<div class="post-metadata">

**Author:** ![johnny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@johnny](https://www.ruby-forum.com/u/johnny)\
**Post date:** [January 12, 2012, 7:43pm UTC](https://www.ruby-forum.com/t/how-to-respond-correctly-to-a-post-request-for-a-static-file/215668/2 "2012-01-12T19:43:12Z")

</div>

[http://invalidlogic.com/2011/04/12/serving-static-content-via-post-from-nginx/](http://invalidlogic.com/2011/04/12/serving-static-content-via-post-from-nginx/)

---

<div class="post-metadata">

**Author:** ![johnny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@johnny](https://www.ruby-forum.com/u/johnny)\
**Post date:** [January 12, 2012, 11:15pm UTC](https://www.ruby-forum.com/t/how-to-respond-correctly-to-a-post-request-for-a-static-file/215668/3 "2012-01-12T23:15:03Z")

</div>

Thanks, but I’m getting a 404, not a 405. Using the solution you linked  
to would require all 404s to be 200, which is not a good idea. Any was  
to limit this to just index.html?

Posted at Nginx Forum:

> **[Re: How to respond correctly to a POST request for a static file?](https://forum.nginx.org/read.php?2,221059,221133#msg-221133)**
>
> hi, I have a Facebook app hosted on nginx. Faceboook fetches the data by issuing a POST request for index.html before embedding it in their canvas. My server replies with 404, instead of the expected 405. If it was 405, I could fix things by adding...
