On Fri, Feb 26, 2016 at 1:34 PM, Ben Williams wrote:

Hello All,

I have been serving a Go web application with Nginx using a reverse proxy.
I have seen some online tutorials talk about using http/2 and using Go with
https. My question is, should I be using Nginx to serve my Go app or is Go
by itself enough? Any advice would be great, everything that I find when I
do a good search is from 3+ years ago and not in the context of http/2 &
  I used to serve via nginx, but switched recently. It has a bunch of
benefits. For one, you can use resp.RemoteAddr to get the IP of the user.
With nginx it's always, and you have to resort to having nginx
write an X-Forwarded-For header. Also, Go 1.6, with its http/2 (as you
mentioned), is great, and serving TLS is exactly as simple as serving HTTP,
so why not?

The only tiny bump in the road is that, if you choose to run it as a
non-root user (as you should, of course), you can't listen on "low" ports
(such as 80 or 443) by default, but that's super-simple to fix:

     sudo /sbin/setcap cap_net_bind_service=+ep yourApp

So I don't see any point in using nginx at all. I don't know anything about
performance, but it stands to reason that the nginx "middleman" is adding *some
*latency, but probably not enough to make it a con.

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 17 | next ›
Discussion Overview
groupgolang-nuts @
postedFeb 26, '16 at 9:42p
activeFeb 28, '16 at 6:40p



site design / logo © 2021 Grokbase