prax on ubuntu machine for RoR - ruby-on-rails

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.

Related

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
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!

why I am not able to access rails localhost on my mobile or other computer

I am trying to access my localhost of rails running project on my mobile device.
This is how I am trying.
http://ip:3000
But it says the webpage is not available.
I tried with another port as well and It doesn't work even there?
What's wrong here? I use to check earlier this way.
Please guide
Try running this code below to your server:
rails s -b 0.0.0.0
This worked for me!
Just give:
ip = your phone's ip address
(Check it in connection information if you are running this on Ubuntu)
ip:3000/your_page if you do not have mapped your root to some page.
Else ip:3000 will work if you have mapped root to some page.
Try it in Chrome and see as it doesn't need any http or https it automatically selects the required one.
Here is how I did it
Put both your computer and phone on the same wifi network
rails s -b 0.0.0.0
routerlogin.net (or however you access your router it will say on the back of router)
get attached devices to the router. Note your computers ip. Mine was 10.0.0.20
on phone go to 10.0.0.20:3000 (but use the ip for your computer from step 4)

How do I make my ruby on rails app respond to external requests (visible to the public on the internet)?

Problem:
My rails app (on my local machine) only responds to requests sent from the same machine to localhost, 127.0.0.1, or my internal ip address. When I try to hit it using my internet ip or from any other machine, inside or outside of my network, it just times out. I'm on Mac OS 10.9.1, ruby 1.9.3, rails 4.0.0.
I've done a lot of searching but all I can find is problems where people didn't forward their ports or bind the right ip.
Here are the areas I've investigated:
Ports -
I've tried several different ports. I configured my router to forward every port I tried but got the same result. I thought maybe there was a problem with the router so I built a simple server in Java and bound all the same ports I was binding with my rails app. Sure enough, when I hit the Java app using my internet ip it worked just fine so the router/firewall/port forwarding isn't the problem. Also, I run an apache server on port 80 and that has never had any problems. I turned apache off and tried port 80 for my rails app but that didn't fix the problem.
Rails Server -
I started with WEBrick and I thought that perhaps there was some setting inside that blocked external requests. I searched google extensively and found nothing on that matter. Just to be safe I installed Thin and got the exact same result I did with WEBrick. One interesting thing is that when the rails server is started, the external request takes a long time to time-out, but the server console displays no output at all. However if I try to send the same request w/out starting the server at all it fails immediately.
User Permissions -
I started the server with root (i'm starting to just shoot in the dark here) and it had no effect.
Environment -
I was starting in development environment originally because I'm developing but just for fun I tried starting in production and it also made no difference.
PLEASE HELP ME SMART PEOPLE
Update:
I installed the app on my Ubuntu machine and it doesn't have this problem! So that suggests the problem may have something to do with Mac OS.
SOLVED:
It turns out that in the System Preferences -> Security & Privacy -> Firewall in Mac OS, it was somehow set to block incoming connections to Ruby 1.9.3. I must have accidentally set that some time ago.
The problem is you are probably trying to request the page from your local machine (or any computer on your local network, behind your firewall) to your public IP expecting a result... not unless you setup routes through your firewall for this (and not usually available on a consumer level router... linksys, dlink, etc)
So forward port 80 if you are using something like pow, or 3000 for web bricks default port to your local machine
Then have someone outside your local lan request your external (public) IP
This may be related: Rails 3.1 on Ubuntu 11.10 under VirtualBox very slow
Your mention of slowness combined with the use of webrick makes me think you've got some reverse-DNS lookup awfulness going on. A quick first step is hacking /etc/hosts to bypass this lookup.
The situation I dealt with on Ubuntu was solved in the short-term by hacking /etc/hosts. You could do this quick hack in order to see if it is indeed just webrick's reverse-DNS lookup. Edit /etc/hosts and add a line for the external user's IP address, something like this:
156.123.48.55 TestPerson
Replace the IP address with the tester's IP address. Since you said you can get the external request to hit an Apache server on port 80, you can grab their IP address from the Apache access logs if necessary, otherwise just ask the person testing.
You could also try a different web server, such as unicorn, which may help out. Add "gem unicorn-rails" to your Gemfile, run bundle install, and then (according to their docs), rails server will just use unicorn directly.
With any local server, you'll need to correctly configure port forwarding on your firewall. Like said by CaptChrisD, tests must be done by an external IP/browser (if you own a server, ssh on it, then w3m to test).
I already had same symptom (server started => timeout, server stopped => fail) and the origin was an issue with firewall configuration. I think it is your problem.
With MacOS, Pow is really awesome: installation is easy, no configuration required (no /etc/hosts…). Moreover, they give you a hook for external access to your virtualhosts (but you still need port forwarding on your firewall).
Otherwise, there is other solutions like Forward to do it without firewall configuration (30-days free trial).
Hope this helps!

Error when trying to open my localhost

Hello guys
i have installed wamp server Version 2.0 .. and i have tried some things and every thing ok ..
i have reboot my Desktop then some thing goes wrong when i am trying to open my local host
EMDAEMON
HTTP/1.1 404 , Not Found
should i consider re-installation ??
Reboot desktop? Open your local host? If you want to do web development you should get familiar with basic computer terminology, at least to a point when you are able to make questions that make a minimum sense.
I'll assume you have installed a bundle that includes the Apache web server and you want to configure a virtual host that's served when you load http://emdaemon in your web browser. The exact details to do so vary slightly depending on your platform. Being a newbie, I suggest you reuse the main site that's already configured and can be loaded through http://localhost. It's roughly explained at http://www.wampserver.com/en/presentation.php. Leave multiples sites for the future :)
Solved .... it seems that we have conflicts in ports ..change port in apache make it works

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