Welcome! Log In Create A New Profile

Advanced

redirect non GET requests directly to Passenger in Nginx

Posted by i0n 
i0n
redirect non GET requests directly to Passenger in Nginx
February 09, 2012 07:41AM
Hi there!

Apologies if this is covered anywhere, but if it is I can't find it!

Basically I need to know how to use try_files if the request method is GET, if it's not I want it to skip straight to passenger.

My config currently looks like this:

server {
server_name railsapp.local;
root /Users/i0n/Sites/railsapp/public;
location / {
try_files $uri /$host/$uri/index.html /$host/$uri.html /$host/$uri @passenger;
}
location @passenger {
passenger_enabled on;
}
}

I have been running Nginx with passenger and rails for a while and it normally works great.

Recently I have been working on a rails app that needs to work a bit differently than normal, it has multiple domains and therefore I have changed the page caching to create directories for each domain inside the public folder. try_files is working for this, but has created a problem where non GET request are returning 405 errors as Nginx is finding the static cached pages. I've been trying to figure this out for a couple of days now with no luck, any help would be much appreciated!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 145
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready