0

I have a Ruby on Rails app running in a docker container on a remote server.

When I'm connected to remote server with ssh like ssh user@<server_ip>, I can ping it with ping mywebapp.localhost. But now, I need to be able to connect to it from my computer (macbook) (for example from chrome browser sending mywebapp.localhost url).

Is it really possible to do that? Could you suggest any solutions or tell me where to dig, please?

1 Answer 1

1

If the host machine has the port where you ran the service exposed you should be able to connect to your service by hitting the IP of the host machine in the port that you are running your service at.

Assuming that you did something like docker run [...] -p 8080:80 you should be able to access that at htttp(s)://:8080, if not, maybe check you ufw(ubuntu) or firewalld(centos, rocky) config.

1
  • it works in case of loading an index page of my app. But when i try to navigate to other pages via links, then it didn't work. In this case urls will be something like this: mywebapp.localhost/products/8897 which doesn't include port number. Same with urls for assets loading. Is it possible to redirect all request to the specific port?
    – Artem
    Mar 13, 2022 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .