Proxy pass set body on if
Francis Daly
francis at daoine.org
Mon Feb 22 18:13:42 UTC 2021
On Mon, Feb 22, 2021 at 07:52:04AM -0500, sanflores wrote:
Hi there,
> This would be great, but I don't know how to server the context from nginx
> with a rewrite, what would work is:
I'm afraid I don't fully understand what response you want to send to
what request.
Can you show some examples?
For example, if you issue the "curl" GET commands
curl -i -H X-Bot:yes http://localhost/one
curl -i -H X-Bot:no http://localhost/one
(let's pretend that you decide bot-or-not based on the X-Bot request
header), then what response do you want in each case?
http 200 with the content of a specific file on the filesystem; http 301
with a redirect to another location; the response from a proxy_pass to
an upstream server; something else?
And if you issue the "curl" POST commands
curl -i -d the_post_data -H X-Bot:yes http://localhost/two
curl -i -d the_post_data -H X-Bot:no http://localhost/two
what response do you want in each case?
(The answer to the question in the Subject: is "you don't" --
http://nginx.org/r/proxy_set_body says "Context: http, server, location",
which does not include "if" or "if in location". So now we are trying
to find your overall requirements, hopefully to make it clear what the
appropriate nginx config is.)
Cheers,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list