Closed nathanl closed 3 years ago
If this PR is merged, I would make a followup PR to Phoenix to add a reference in the comments of the generated config/runtime.exs
where the IP address is set: https://github.com/phoenixframework/phoenix/blob/6605625065e2ea924bb0458335674756ad67ccdf/installer/templates/phx_single/config/runtime.exs#L20
I was not able to confirm that by looking at the Cowboy code
This is the gen_tcp default configuration. You can pass the ipv6_v6only flag if you want only v5.
Looks great, I have just added two minor nitpicks!
@josevalim I addressed your feedback and documented ipv6_v6only
, which was news to me (thank you!).
:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:
I wanted to document this somewhere for Phoenix users and I thought this might be the best place.
One thing I did not address: when should you use an IPv6 or IPv4 address? It appears to me from experimentation that, unlike Nginx, Cowboy will serve traffic on IPv4 if you bind to an IPv4 address, or on both IPv6 and IPv4 if you bind to an IPv6 address. I was not able to confirm that by looking at the Cowboy code, so I'm not sure, nor am I really sure when one would want to use one or the other. But maybe someone else could elaborate later.