Rails IPv6 server

末鹿安然 提交于 2019-12-05 19:14:00

问题


I'm using a development server which I currently only have IPv6 connectivity to, and I'm working on a rails application.

I tried to use bundle exec rails s -e development -p 3003 -d to start a server, but it seems it only binds to IPv4:

tcp        0      0 0.0.0.0:3003                0.0.0.0:*                   LISTEN      27165/ruby          

thus I can't connect to it. What's my best option to proceed? I'm not really very familiar with rails just trying to fix a few issues on an existing application.

version info:

:; ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
:; rails --version
Rails 3.2.8

回答1:


Figured it out myself, -b :: will make it listen on both IPv6 and IPv4 (depending on sysctl net.ipv6.bindv6only probably).




回答2:


On puma you should do:

rails s -b [::] 

as per RFC2732, literal IPv6 addresses should be put inside squares. If not, you will receive a parsing error.



来源:https://stackoverflow.com/questions/13725236/rails-ipv6-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!