Friday, January 13, 2012

Serve static files from nginx for POST request

This is a quick tip, I haven't had the time to dig deep into this. I am working on a Facebook app, and was doing a demo with static HTML. Everything was set, including SSL (I will write quick tip on that too). I could browse to the page separately. But it failed from within Facebook, giving a 405 error.

From previous experience I remembered Facebook does POST requests, but I had forgotten the fix for static files. For some reason nginx does not allow serving static files for HTTP POST request. Anyway the fix was:

    error_page 405 = $uri;


Also here is another suggestion: Serving Static Content Via POST From Nginx

Hope this helps you.

3 comments:

tommew17 said...

thanks for that hint

Federico Biglia said...

Thanks very much!
You solve me a big issue!!!

marcowue said...

Helped me to provide autodiscover.xml via NGINX as Outlook sends a POST command to retrieve the data. Thanks a lot!

Post a Comment