How do I redirect/handle requests from search engines via nginx using location regex

Raviteja Dodda raviteja at pipallabs.com
Wed Apr 25 08:40:53 UTC 2012


Hi,

I have developed an ajax-based web application with hash bang urls.

I am trying to redirect requests from search engines to another server
which generates HTML snapshots and send the response. I am trying to
achieve this in nginx with the location directive as mentioned below:

      location ~ ^(/?_escaped_fragment_=).*$ {
         proxy_set_header        Host $host;
          proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header        X-Forwarded-Proto $scheme;

          client_max_body_size    10m;
          client_body_buffer_size 128k;
          proxy_connect_timeout   60s;
          proxy_send_timeout      90s;
          proxy_read_timeout      90s;
          proxy_buffering         off;
          proxy_temp_file_write_size 64k;
          proxy_pass      http://x1.x2.x3.x4:8080;
          proxy_redirect      off;
      }

But I am not able to get this working. Can someone correct the regex I am
using (or) provide me an alternative solution to achieve this.

Thanks in advance,

Ravi
-- 
This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and
delete this e-mail from your system. E-mail transmission cannot be
guaranteed to be secure or error-free as information could be intercepted,
corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message, which arise as a result of e-mail
transmission. If verification is required please request a hard-copy
version. Pipal Tech Ventures Private Limited (www.pipaltechventures.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120425/96b1ae18/attachment.html>


More information about the nginx mailing list