mc-router icon indicating copy to clipboard operation
mc-router copied to clipboard

Cannot access api

Open maxcerny opened this issue 3 years ago • 1 comments

Here is my docker-compose, running on a docker swarm, domain is just a placeholder.

One of the hosts is 172.16.100.56

version: '3.4'

services:
  router:
    image: itzg/mc-router
    ports:
      - 25565:25565
      - 8080:8080
    command: --mapping=domain=test1:25565,domain=test2:25565
    environment:
      API_BINDING: ":8080"
      DEBUG: "TRUE"
  test1:
    image: itzg/minecraft-server
    environment:
      EULA: "TRUE"
  test2:
    image: itzg/minecraft-server
    environment:
      EULA: "TRUE"

A request from the same machine returns:

debian@Docker-Swarm-1:~$ wget 172.16.100.56:8080/routes
--2022-04-25 03:08:49--  http://172.16.100.56:8080/routes
Connecting to 172.16.100.56:8080... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-04-25 03:08:49 ERROR 404: Not Found.

A request from my laptop isn't any better.

Any ideas?

maxcerny avatar Apr 25 '22 07:04 maxcerny

You would need to specify the "Accept" header

to file wget --header="Accept: application/json" 172.16.100.56:8080/routes

or just the response to the console wget -qO- --header="Accept: application/json" 172.16.100.56:8080/routes

curl (better for query) curl -w "\n" -H "Accept: application/json" 172.16.100.56:8080/routes

anthony-mariotti avatar Nov 11 '22 20:11 anthony-mariotti