Dual stack (IPv4/IPv6) support #1529
-
Hello everyone and thanks for your work on this great project 😺 I find it especially helpful in combination with FastAPI, which is my use case. What I cannot use is the dual stack mode (combined IPv4/IPv6) on the socket used by Uvicorn, which would come in handy in environments in which both IP versions are supported. In this case, I would assume to use the IPv6 host address provided by the user and then add the dual stack mode on top. From my point of view this would be a pretty straight forward implementation by extending the config method if socket.has_dualstack_ipv6():
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0) Is this something you would support in the product? Cheers and have a nice evening, |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 30 replies
-
nothing against it, question is how is it testable ? |
Beta Was this translation helpful? Give feedback.
-
Hi, any updates? |
Beta Was this translation helpful? Give feedback.
-
I've been going down this rabbit hole but it seems to me that dual stack IPv4/IPv6 support is disabled in Python asyncio as per these lines of code so I don't think anything can be done about this in uvicorn. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, so is there an alternative that I can us to deploy and make the dual stack possible with my fast api backend or do I have to switch to another backend framework completely, because right now in my case node js fetch prefers ipv6 and I am not mapping anything on my fast api backend to ipv6 and as such it fails because of "::1" error. So if this is not possible right is there an alternative you guys know about? Thank you. |
Beta Was this translation helpful? Give feedback.
-
Testing uvicorn 0.20 in ubuntu and macos , |
Beta Was this translation helpful? Give feedback.
-
I've just tried to fix this in the fork |
Beta Was this translation helpful? Give feedback.
-
Both IPv4 and IPv6 are supported, although this is not documented. The following code snippet demonstrates this functionality: uvicorn.run(app, host=["::", "0.0.0.0"], port=8080) |
Beta Was this translation helpful? Give feedback.
-
It would still be great to be able to set this through command line because one do not always have access to the code... |
Beta Was this translation helpful? Give feedback.
#1529 (reply in thread)