What is the best way to forward (spoof) a production URL (port 80) on local rack development (port 5000)?
Question
I am new to heroku/sinatra and have an app with an oauth callback URL. The simplest thing to do seems to be to modify /etc/hosts
to spoof the production URL on my local machine, looping back to 127.0.0.1
The problem is that when I use foreman or shotgun locally, they do not listen on port 80 (And I'd prefer for them not to)
What is the best way to make requests to my-app.herokuapp.com:80 be served by localhost:5000 ?
Solution
I was trying to achieve something like this as well, but wasn't able to direct request from one port to another without running a proxy (i.e. directing requests from port 80 in the browser to 5000 on the server).
However, I got this workaround that's fairly close:
# in your /etc/hosts file:
127.0.0.1 my-app.herokuapp.com
Then, if your Shotgun runs on port 5000, you should be able to acess http://my-app.herokuapp.com:5000
in the browser.