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

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

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!

Related

How to access phpmyadmin on DDEV Windows 10 pro localhost with SSL record too long error

I am using DDEv and Docker with Windows 10 pro to set up a localhost install of drupal 8.8 using Composer. I have set up and configured the local drupal installation (it is a fresh install) and it appears to be running correctly, but in the admin section of the drupal site I receive a warning to change write permissions of sites/default/settings.php.
I tried to change settings using Filezilla, but it appears that local files in Filezilla do not provide access to write permissions? When I right-click the file in Filezilla, no permissions option appears.
Following troubleshooting tips from ddev, I tried to access phpmyadmin at https://mysitename.ddev.site:8036
Instead of loading phpmyadmin, I got the following error message:
Secure Connection Failed
An error occurred during a connection to dmckimep.ddev.site:8036. SSL received a record that exceeded the maximum permissible length.
Error code: SSL_ERROR_RX_RECORD_TOO_LONG
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.
I've been searching around for a couple of hours now and do not find a solution to this. I ran ddev describe and all seems fine with the installation. The drupal site in the container seems to run okay. There are no port conflicts present so far as I have found, so I am not sure why I cannot get access to phpmyadmin.
I am a relative newbie in terms of skills, but have successfully maintained drupal 4-7 on localhost with XAMPP and my web host. Now I am wrestling with the move to drupal 8/composer/docker/ddev. Any suggestions would be much appreciated.
Thank you!
Update 2022-09-14: DDEV has had https support fpr PHPMyAdmin and MailHog for years now, ddev describe will show you the URL.
(Original answer) ddev's PHPMyAdmin connection doesn't support https, just http. You can find the links for both PHPMyAdmin and MailHog using ddev describe; both are http-only, as in your example, http://mysitename.ddev.site:8036. It would be possible to provide https URLs for PHPMyAdmin and MailHog, but nobody has ever asked for them, and there's no security reason to do so.
Note that the key reason for https on the actual project URL is because real projects run behind https and people need to see problems like mixed content during the development phase. But there's no such need for PHPMyAdmin. However, I'm sure if people ever want it, we'll do it, it's not hard to do.
Just as a general add on, after ddev start you can run ddev launch -p in order to open PHPMyAdmin for the current project database in the browser.

How to set in meteor --mobile-server when using nginx

I have on digitalocean my meteor application running but when I try and test on my iphone the app I am not able to see the login screen.
I don't think it's version dependent and I therefore do not list them. I am happy to provide all the config files if this helps but want to make sure that I am not missing anything conceptually.
My setup is that on my digitalocean (not real URL: https://ABC123.com) server I run the meteor app and the app works fine at the URL. The meteor application has been deployed a while back and is a different release from what I am testing now locally. Source code is quite similar though and it never worked on the iphone. nginx is used to forward the URL domain to
proxy_pass http://127.0.0.1:3100;
Here is the issue now:
I run from my local mac:
meteor run ios-device --mobile-server https://ABC123.com
and run from xcode on the simulator or my iphone and get the attached screenshot. You can see that there is no login prompt which I believe is caused that I do not connect to the server on digitalocean.
It's a also surprising that with the command meteor runs on localhost:3000 as well. But it's probably not the issue.
The way it should look is the below which is taken from the web page:
Thanks already in advance for any responses.
This is resolved. Using Safari as a debugger I noticed that the connection to the server failed due to a non AC SSL certificate. So, after I fixed the SSL certificates it does connect now.

prax on ubuntu machine for RoR

Has anyone successfully installed and configured 'prax' https://github.com/ysbaddaden/prax ? I have tried configuring it on multiple pc but no success.
There is pow but it works only on OSX. If any other alternative please share.
First, install Prax and configure your apps as stated on its GitHub.
To know if actually is working, ping to a desire app.
ping myapp.dev
It should ping to your loopback (127.0.0.1). If this is not your case, check again.
Then follow this steps:
1) Restart your server
2) Restart your browser. If you are using Chrome, you might need to clear the cache (as stated on: https://github.com/ysbaddaden/prax/issues/51 and Pow domains not loading in Chrome)
3) Launch the app:
http://myapp.dev/
It is important that the first time you use the http:// prefix.
If you are using Rails (which server Webrick defaults to port 3000, you should add this port to the URL, (I couldn't figure it out how to avoid this):
http://myapp.dev:3000/
check on firefox.I had same problem in chrome, then I switched to firefox and It was working.

Rails Dev Server not visible on network

Trying to do something very basic and test my Rails app on my phone.
Starting the server with:
rails s
But when accessing mymachinename.local:3000, Mobile Safari says that the server stopped responding after about 30 seconds.
I do this all the time on other machines, but I have no idea what could be causing it here. Any suggestions?
I've had a similar issue before trying to access the server from a virtual machine, I had to use the following format for the rails server command:
rails s -b your.dev.ip.address
Whoops. Firewall. Don't know why I even had it turned on.

Cannot access http://localhost:3000

I am trying to learn Ruby on Rails, I have followed the instructions from this page to get rails installed on my PC.
I am also trying to follow this webcast to try and learn the language and framework. Everything is working so far, apart from the fact that I cannot access
http://localhost:3000
http://0.0.0.0:3000
http://127.0.0.1:3000, or
http://<actual IP address>:3000
locally. If I try the from another PC on my network then it works great. I have tried in Chrome, Firefox and IE7 but none work.
Has anyone else had this problem?
EDIT: Typical!! It's started working now. I have no idea why, I am typing the exact same address in to the address bar and it now works. But only if I use http://127.0.0.1:3000, localhost doesn't work. I do run IIS ASP.NET/ASP websites on this machine, and they work fine with localhost.
EDIT 2: If I trying pinging localhost it actually says
Reply from ::1: time<1ms
0.0.0.0 yields...
PING: transmit failed, error code 1214
only 127.0.0.1 seems to work. I did have IPv6 turned on, so I've disabled that and will try again tomorrow to see if a reboot helps.
I had this issue as well with Vagrant. The secret is to run
bin/rails server -b 0.0.0.0
What 0.0.0.0 means is to listen to all interfaces, not just on localhost. The alternative is to SSH into the vagrant machine with a SOCKS proxy.
ssh -C -D 8080 vagrant#localhost
Open up your Internet explorer proxy settings and set the SOCKS v5 proxy to port 8080.
In order to access http://localhost:3000 you need to run the local Rails server in a terminal window:
$ rails server
This is described in this section of the Rails Tutorial book.
Note: I am the presenter of the screencasts in question.
Can you telnet to the port? Try:
telnet localhost 3000
That should tell you if the ports unavailable at the TCP level, or whether something's going on at the HTTP level.
Ping might not work if ICMP is disabled, which could be completely unrelated to your issue.
Also, try looking in your hosts file for any redirections:
c:\Windows\System32\drivers\etc\hosts
One way is to do the simple
rails s
Another (more specifically) is
rails start localhost 0.0.0.0
or
rails start 0.0.0.0
another way is
rails s 0.0.0.0
all of these works
I had an epic issue with my System Path (Environmental Variable) not being set properly.
Simple copy paste job, unplugged the 1 week stalled Ruby installation.
Control Panel > System > Advanced tab > Environment Variables > System variables > Path... Edit...
Make sure it contains these paths (among others)...
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
I had your same identical problem. You have simply to run
$ rails server
from inside the folder of your application, not outside...so, if you have your application in
C:\Sites\myapp\blog
and blog is the folder where live your app, the command has to be prompted from here. Launching it from myapp folder won't work.
Are you possibly using a proxy but haven't listed localhost as proxy exception?
Have you tried disabling your firewall? They can cause pesky problems at times.

Resources