Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

ubuntu - When running "rails server" why does my localhost refuse to connect on both Chrome and Firefox?

I'm trying to see my Ruby on Rails app on my localhost, when I run rails server it looks like it is running good with no errors but when I open up my localhost at http://localhost:3000/ it redirects me to https://localhost:8080/ and says refuses to connect. I am able to open my localhost files with no problems but when I run rails server and open localhost with the port it redirects me to https instead of http no matter what I do. I even tried running with different ports. I am on Ubuntu and my app is using Puma.

I have done the following so far:

  • Cleared all my cache & history
  • Opened incognito window
  • Ran rails server with different ports
  • Changed some about:config settings to false in firefox
  • Have searched localhost in 'chrome://net-internals/#hstsand' but says not found
  • I've tried the other solutions on this link: Google Chrome redirecting localhost to https

None have worked at all. What could the problem be?

I get this error on Chrome

And this error on Firefox

Any advice on this helps! Thanks.

EDIT: Let me know if this needs to be changed, this is how I have my etc/host/ set up


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After scrolling through posts and much research my issue was that I did not run yarn before running rails server. I found this post and referred to this answer https://stackoverflow.com/a/58369306/14365156

But I did not follow those steps exactly, I only ran yarn then ran rails server and now am finally able to view http://localhost:3000/. Hopefully this helps others!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...