无法通过主机名访问本地应用

时间:2017-05-20 13:39:20

标签: ruby-on-rails localhost ruby-on-rails-5 hosts

我的开发环境中需要一个域名(而不是localhost)才能测试Facebook登录。所以我已将以下内容添加到我的/etc/hosts文件中:

127.0.0.1       dev.mydomain.com

但是当我重新启动服务器并尝试访问http://dev.mydomain.com:3000时会发生什么情况,如果首先重定向到https然后在服务器日志中返回:

  

2017-05-20 15:23:31 +0200:HTTP解析错误,格式错误的请求():#

     

2017-05-20 15:23:31 +0200:ENV:{" rack.version" => [1,3]," rack.errors" => ;#>," rack.multithread" => true," rack.multiprocess" => false," rack.run_once" => false, " SCRIPT_NAME" =>""," QUERY_STRING" =>""," SERVER_PROTOCOL" => ;" HTTP / 1.1"," SERVER_SOFTWARE" =>"美洲豹3.8.2 Sassy Salamander"," GATEWAY_INTERFACE" =>& #34; CGI / 1.2"}

知道我的问题可能是什么,以便我在localhost:3000成功访问我的应用程序?

1 个答案:

答案 0 :(得分:0)

您可以尝试以下方法: