Welcome! Log In Create A New Profile

Advanced

rewrite ajax requests?

Posted by Mark 
rewrite ajax requests?
October 18, 2011 02:14AM
I'm caching partials with the intention that Ajax requests can receive them directly from Nginx without hitting my Rails server.

I've tried :

if ($x_requested_with = XMLHttpRequest) {
rewrite ^(.*)$ /ajax/$1 break;
}

which gives me : unknown "x_requested_with" variable.

What should be the approach here?

Thanks.
Re: rewrite ajax requests?
October 18, 2011 02:41AM
Ok, it would help if I wasn't an idiot :-)

if ($http_x_requested_with = XMLHttpRequest) {
rewrite ^(.*)$ /ajax/$1 break;
}

I found the http_ tip after more digging around.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 247
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready