Nginx servers on both *:80 and <ip>:80? also duplicate listen parameters error when binding by just specific ips
CJ Ess
zxcvbn4038 at gmail.com
Sat Apr 2 20:36:02 UTC 2016
Your right, I should make a simple test case like you did in the prev
message. I'll put that together.
On Thu, Mar 31, 2016 at 4:29 PM, Francis Daly <francis at daoine.org> wrote:
> On Thu, Mar 31, 2016 at 01:21:02PM -0400, CJ Ess wrote:
>
> Hi there,
>
> > I would like to have an Nginx setup where I have specific logic depending
> > on which interface (ip) the request arrived on.
>
> multiple server{} with different "listen"; possibly with an "include
> common-config" entry.
>
> Note: "listen" is on an ip, not an interface.
>
> > I was able to make this work by having a server stanza for each ip on the
> > server, but was't able to do a combination of a specific ip and a
> wildcard
> > ip (as a catchall) - is there a way to do that with some option
> combination
> > (i.e. nginx listens on *:80, but matches the server stanza by ip?)
>
> I don't understand what you are describing. Could you try again, perhaps
> with a config example?
>
> When I use
>
> ===
> server {
> listen 127.0.0.1:8088;
> return 200 "listen 127.0.0.1:8088\n";
> }
> server {
> listen 10.0.1.2:8088;
> return 200 "listen 10.0.1.2:8088\n";
> }
> server {
> listen 8088;
> return 200 "listen 8088\n";
> }
> ===
>
> I get the following output, which is what I expect:
>
> $ curl http://127.0.0.1:8088/
> listen 127.0.0.1:8088
> $ curl http://127.0.0.2:8088/
> listen 8088
>
> > The scenario I'm playing towards is that I have a dedicated connection
> to a
> > CDN and I want to pass thru certain headers if they arrive via the
> > dedicated interface, strip them if they arrive on other interface.
>
> As above, if "interface" is replaced with "ip", this can work with two
> server{} blocks.
>
> > When I did the server{} per IP approach nginx complained about duplicate
> > listen settings for the second IP even though both server stanzas were
> > bound to a specific port/interface. Is this a bug per chance?
>
> What short server{} config can I use to reproduce the complaint?
>
> f
> --
> Francis Daly francis at daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160402/e20d225e/attachment.html>
More information about the nginx
mailing list