Accessing host different ports in production

im making an app with Vue.js as frontend and Rails as backend, everything running with docker on development and production.

in development, i can access the services with localhos:8080 (front end) and make request to the backend url with localhost:5678 (rails port).

  • Unable to connect to dockerized postgres on localhost, but remote connection is working
  • Registrator not listening to docker events
  • Different localhost ports causes failed Access-Control-Allow-Origin
  • openshift v3 pod file not found
  • Spark app unable to write to elasticsearch cluster running in docker
  • Automatically create docker container and launch python script
  • but when i deploy this to production, wich has a domain name(www.websiteurl.com), i can view the front end but cant access the backen, i am unable to make any request.

    i try to make requests to www.websiteurl.com:5678 and nothing happens, how can i access the backend port with a domain name?

    ps1: Im sorry if the question is not clear enough, feel free to ask anything
    ps2: I have correctly set up CORS access on the backend
    ps3: if i access the production server via IP, it works correctly, the problem is when i access via the domain name

    Update:
    Command used to run front-end:

    docker build -t runaterra:ekko .
    docker run -d \
        -w /runaterra-ekko/ \
        -p 80:8080 \
        --name ekko \
        --restart unless-stopped \
        runaterra:ekko npm run dev
    

    Command used to run backend:

    docker-compose up -d --restart unless-stopped db
    docker-compose build app
    docker-compose run --rm app rake db:migrate
    docker-compose up -d --restart unless-stopped app
    

  • openshift wso2api manager redirect error
  • Docker container rake file error
  • Getting error installing nodejs when building from docker
  • Docker publishing ports to multiple IPs
  • Swarm: Manager in host + Worker in VM: No containers in workers
  • how to copy file from my localhost to running container?
  • One Solution collect form web for “Accessing host different ports in production”

    You didn’t expose port 5678 of your app to the internet.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.