Home > Software design >  Rails app running on locahost, but I get connection refused whenever I check the web browser
Rails app running on locahost, but I get connection refused whenever I check the web browser

Time:12-19

I have a rails application that I have been running on port 3000 for weeks without any incident, but I am getting connection refused all of the sudden.

When I start the rails server, I get this output on the console:

=> Booting Puma
=> Rails 6.1.4.1 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.5.2 (ruby 3.0.2-p107) ("Zawgyi")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 717
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000

My problems started after I ran JMeter to learn about load testing (I was able to run 2 tests, but then it broke). My rails application is running on the linux subsystem for Windows 10 (wsl 2), and I used Apache JMeter 5.4.2.

I also tested a NodeJs application, tried using other ports (e.g. 8080) and I still get connection refused.

I made a curl request to http://localhost:3000/ and it worked just fine, same url on any web browser still gets me connection refused.

CodePudding user response:

I figured out what the problem was and fixed it. It turns out that if I ran a node js application on windows, it worked just fine, so all signs pointed that the problem was actually on wsl2.

I found a very helpful article https://appuals.com/localhost-refused-to-connect/ that guided me, and all I needed to do was restart the LxssManager.

Posted on behalf of the question asker

  • Related