<div dir="ltr"><div>Dear Phillip,</div><div><br></div><div>I know Tailscale very well, I use it and like it a lot. But my final goal is finding a way to implement the ONVIF Uplink service, <a href="https://www.onvif.org/specs/srv/uplink/ONVIF-Uplink-Spec.pdf">https://www.onvif.org/specs/srv/uplink/ONVIF-Uplink-Spec.pdf</a> , where I can have several devices on the LAN that need to connect to a remote server, which will then send commands.</div><div><br></div><div>Therefore I need a way to start a connection from nginx (or an external program and then passing the fd through a unix socket domain) and make it act as if the fd were obtained from an accept.</div><div><br></div><div>Nginx works with events and I find it very difficult to find a mechanism to pass this connection to it.</div><div><br></div><div>Do you have other ideas?</div><div><br></div><div>Thank you,</div><div><br></div><div>Ottavio<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno ven 27 ago 2021 alle ore 13:10 Phillip Odam <<a href="mailto:phillip.odam@nitorgroup.com">phillip.odam@nitorgroup.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Ottavio<div><br></div><div>I get you now, you’re trying to find a way for the remote server to get through your NAT router. Who controls the remote server? Because even if you initiate the TCP connection to it unless it ‘knows’ to make an HTTP request back nothings going to happen.</div><div><br></div><div>The simplest approach for getting through your NAT would be to just setup a port forward, any particular qualms with that? It can be shied away from for security but managed properly it’s a perfectly acceptable approach.</div><div><br></div><div>As an aside, these guys wrote up a brilliant piece on punching holes through two NATs (the public sides each facing each other over the internet) <a href="https://tailscale.com/blog/" target="_blank">https://tailscale.com/blog/</a>, at a quick glance I couldn’t spot the particular post.<br><br>Cheers</div><div>Phillip<br><br>On Friday, August 27, 2021, Ottavio Campana <<a href="mailto:ottavio@campana.vi.it" target="_blank">ottavio@campana.vi.it</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear Phillip,</div><div><br></div><div>I think it is not what I am trying to do (or I did not completely understand your solution).</div><div><br></div><div>As far as I understand, when nginx dispatches a request it checks if it is a file or, among others, something that can be retrieved from an upstream. But upstreams act as clients, they do accept requests coming from the remote server.</div><div><br></div><div>My goal is to have a connection to a remote server that is somehow started by the nginx, but then the connection is reversed, the "upstream" makes requests and nginx responds.</div><div><br></div><div>Is there a way to achieve this with upstreams?</div><div><br></div><div>Thank you,</div><div><br></div><div>Ottavio<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 26 ago 2021 alle ore 21:58 Phillip Odam <<a href="mailto:phillip.odam@nitorgroup.com" target="_blank">phillip.odam@nitorgroup.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Ottavio<div><br></div><div>I’m probably overlooking something in the description of what you want but I think NGINX out of the box provides you with what you want.</div><div><br></div><div>Here’s an example of one I’ve implemented.</div><div><br></div><div>A software project I don’t develop retrieves dependencies from <a href="http://w3.org" target="_blank">w3.org</a> (it’s a SOAP web service that retrieves a remote XSD) </div><div><br></div><div>The trouble with depending on a file sourced from <a href="http://w3.org" target="_blank">w3.org</a> is that if the file is requested too frequently <a href="http://w3.org" target="_blank">w3.org</a> will rate limit your requests.</div><div><br></div><div>One solution would be to store the XSD in the web service but that’d require changing the application.</div><div><br></div><div>I chose to run an NGINX where it’s upstream was configured to point at <a href="http://w3.org" target="_blank">w3.org</a> and to avoid needlessly retrieving the same content repeatedly a cache was used.</div><div><br></div><div>So the NGINX was listening on local host in this case and for the backend it was connecting to whatever <a href="http://w3.org" target="_blank">w3.org</a> resolves to. And so no changes were needed in the app I changed the servers hosts file to point <a href="http://w3.org" target="_blank">w3.org</a> to localhost. This isn’t a problem for NGINX to connect to <a href="http://w3.org" target="_blank">w3.org</a> as the <a href="http://w3.org" target="_blank">w3.org</a> IP was hard coded in the upstream.</div><div><br></div><div>And NGINX’s built in connection counting works with this.<br><br>Barring the cache is this what you’re describing you want?</div><div><br></div><div>Phillip<br><br>On Thursday, August 26, 2021, Ottavio Campana <<a href="mailto:ottavio@campana.vi.it" target="_blank">ottavio@campana.vi.it</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello,</div><div><br></div><div>I want to write a module for an nginx that runs on a device with a private IP address and behind NAT, connects to a remote server and adds the newly created connection to the list of connections handled by nginx. At this point the remote server will invert the connection and start making requests.<br></div><div><br></div><div>I tried studying the documentation on <a href="http://nginx.org" target="_blank">nginx.org</a>, but I am not able to get an idea about how to achieve this.</div><div><br></div><div>Can you please give me a suggestion about how to do it?</div><div><br></div><div>Thank you,</div><div><br></div><div>Ottavio<br></div><div><br></div><div>-- <br><div dir="ltr">Non c'è più forza nella normalità, c'è solo monotonia<br></div></div></div>
</blockquote></div>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></blockquote></div><br clear="all"><br>-- <br><div dir="ltr">Non c'è più forza nella normalità, c'è solo monotonia<br></div>
</blockquote></div>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Non c'è più forza nella normalità, c'è solo monotonia<br></div>