This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### If a bot requests an escaped URL then rewrite the request to SEO4Ajax location | |
if ($args ~ _escaped_fragment_) { | |
rewrite ^(.*)$ /seo4ajax$1 last; | |
} | |
### SEO4ajax location to handle proxyfication to SEO4Ajax API | |
location /seo4ajax/ { | |
rewrite ^/seo4ajax/(.*) /seo4ajax_key/$1 break; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host api.seo4ajax.com; | |
proxy_pass http://api.seo4ajax.com; | |
} | |
location / { | |
try_files $uri /index.html; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
try_files $uri @seo4ajax; | |
} | |
location @seo4ajax { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host api.seo4ajax.com; | |
set $seo4ajax 0; | |
### If a bot requests an escaped URL then rewrite the request to SEO4Ajax location | |
if ($args ~ _escaped_fragment_) { | |
set $seo4ajax 1; | |
} | |
### SEO4ajax location to handle proxyfication to SEO4Ajax API | |
if ($seo4ajax = 1) { | |
rewrite ^(.*)$ /seo4ajax_key$1 break; | |
proxy_pass https://api.seo4ajax.com; | |
} | |
if ($seo4ajax = 0) { | |
rewrite .* /index.html break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment