Skip to content

Conversation

@SakuraPuare
Copy link
Contributor

feat: set server_name to None to enable dual stack in web page

feat: #2064

实现双栈访问,ref to: Kludex/uvicorn#1529 (reply in thread)

已经测试以下 host

  • 0.0.0.0
  • 127.0.0.1
  • 192.168.38.197 (interface ip)
  • [::0]
  • [::1]
  • localhost (hosts to localhost and [::1])

需要被进一步讨论

hosts file

127.0.0.1 localhost ::1 localhost
@binary-husky
Copy link
Owner

这个我不是很熟,我印象中 localhost 是不是就不能被局域网其他机器访问了

@SakuraPuare
Copy link
Contributor Author

要看uvicorn监听的接口,修改前的0.0.0.0,监听的是所有接口,其实是暴露在局域网上的,但只是ipv4 only。

修改后监听接口还是全部,但是有监听v6

@SakuraPuare
Copy link
Contributor Author

这个我不是很熟,我印象中 localhost 是不是就不能被局域网其他机器访问了

localhost 只是通过其中的一个host访问的 其实你用0.0.0.0 或者接口ip一样能访问,除非只监听127.0.0.1

@SakuraPuare SakuraPuare closed this Feb 4, 2025
@SakuraPuare SakuraPuare deleted the patch-dualstack branch February 4, 2025 16:39
@SakuraPuare SakuraPuare restored the patch-dualstack branch February 4, 2025 16:39
@SakuraPuare SakuraPuare reopened this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants