Ngrok redirecting to lvh.me - ruby-on-rails

Awhile back, lvh.me was broken for me locally when running feature tests for rails. I solved the issue by editing a file locally that ensured lvh.me would point to localhsot:3000 - it was a solution I found after much googling, and now I cannot remember what file it was that I edited or what the solution was.
Enter a new problem: I'm trying to use ngrok to point to my localhost:3000 in order to test Amazon Connect integration, but ngrok consistently redirects to lvh.me instead - which, for my organization, points to our production site and database. Ngrok is pointing to Web Interface http://127.0.0.1:4040 and says it's forwarding to localhost:3000
Why is ngrok redirecting to lvh.me, and how do I fix this?

I'm not sure about the solution but I think file you was edited to ensure lvh.me pointed to localhost:3000 is located at /etc/hosts.

Related

Ngrok Redirecting To Welcome Rails Page With Subdomain

I'm running my project on the domain http://app.lvh.me locally and it works fine.
I'm running this command with ngrok:
ngrok http --host-header=rewrite --request-header-remove 'referer' app.lvh.me:3000
And the result is Ngrok forwarding like this:
Forwarding https://(mylinkhere).ngrok.io -> http://app.lvh.me:3000
When I go to the link that ngrok gave me, it doesn't redirect me to app.lvh.me but instead it seems to redirect to lvh.me since all I see is the welcome rails page.
I've been going at this for a few hours and read every thread but can't find the solution.
Please help, thank you

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!

URL only resolving with TOR Browser otherwise error ERR_NAME_NOT_RESOLVED

I've the following situation. I made a SPA with React/Redux and deployed it with gh-pages to github. In the package.json the homepage is https://www.url.com. The DNS on the domain provider (Uniregistry) points to my cloudflare instance. On cloudflare I have 4x A-records pointing to the IP for github. And one CNAME with wwwwwhich resolves to iepur1lla.github.io.
When I try to access the URL via Chrome I get ERR_NAME_NOT_RESOLVED, though when I try to access the URL via TOR browser it works perfectly fine, redirect and SSL certificate, everything.
At first I researched on Stackoverflow, what could cause this issue, and I checked the DNS propagation for my country. And it points to Cloudflare, and my github URL points to the IPs which are as A records in cloudflare.
I really could use an advice. Thanks in advance.
The issue is resolved. After investigating with the dig and nslookup commands, I found out that in some cases the default DNS from Uniregistry which has been updated to Cloudflare DNS, was still resolving. I went to uniregistry and purged my DNS servers and put the same cloudflare DNS in and after waiting the TTL time it resolved fine. Yay!

www.sample.com automatically redirected to sample.com

I'm running two sites on Linode. Testing server.
I have one Wordpress site running on sample.com
I have another Ghost site that I want to run on www.sample.com
Note: the first one doesn't have www prefix
However when I try to access www.sample.com my browser instantly shows my Wordpress site at sample.com ( the one without www )
I can not narrow down where this setting is being enforced at.
I figure it either has to be in the Linode DNS settings -OR- in the nginx server settings. I can't find anything indicating that there should be a redirect of any kind.
Ammendment: On the nginx side, there is are two configuration files. The default server config file is pointing to the Wordpress installation which is loading for both www and non-www cases.
Ammendment: The remaining 1 configuration file is pointing to the Ghost installation.
Ammendment: When using the same two configuration files, but only changing the hostname to be "mail." instead of "www." the ghost installation loads just fine. The "mail." host was already registered in the dns settings, so I just borrowed it as a test.
What am I not consdering?
I'm not quite sure what happened. But, 24 hours later, the problem went away. Somewhere in the pipeline, old host/ip/port sets were getting cached and I couldn't resolve where. But, now it's working fine.
Thanks Richard Smith for taking time to talk me through it.

Heroku app moving to VPS, dns fails

I've removed my app from Heroku, but I forgot to remove my custom domain from heroku. Now i'm stuck with two versions of one site. .nl is working correctly, www..nl is giving me the error message "Heroku | No such app"
What to do? I've already edited my DNS records, but still doesn't fix this problem,
Many thanks,
If you are getting a Heroku message, then your DNS is still pointing to Heroku. There is no Heroku setting that could cause it to take control unless your DNS is sending traffic there.
If http://something.nl is working, but http://www.something.nl is not, then you probably didn't change all of your DNS settings properly.
The only other option I can think of is that your webserver on your VPS is routing traffic from www to the Heroku app, that is very unlikely though.
Last option... wait longer for DNS propagation if everything is correct.

Resources