Allow addressing docker service names for ingress rules

I find it devastating that I could not use mongodb:27017 as the origin of a host. For example,

ingress:
  - hostname: mongodb.test.domain
    service: http://mongodb:27017/
  - service: http_status:404
services:
  cloudflare-tunnel:
    image: cloudflare/cloudflared:latest
    command: tunnel --config /etc/tunnel/config.yaml run
    volumes:
      - ./mongo/cloudflare:/etc/tunnel
    networks:
      - network_cloudflared
      - network_mongo
    depends_on:
      - mongodb

Cloudflared errors:

http://mongodb:27017/ is an invalid address, ingress rules don't support proxying to a different path on the origin service. The path will be the same as the eyeball request's path

I use Docker compose for my projects. Without this feature, it feels almost impossible to integrate other docker services to Cloudflared unless localhost is specified.

Isn’t mongodb TCP?
Also, try removing the / from service: http://mongodb:27017/

2 Likes

But you can?

image

cloudflared isn’t involved here - if your Docker containers can’t talk to each other using their container names then you need to fix that with your Docker setup.

The error shows that it’s unrelated to DNS.

if u.Path != "" {
    return Ingress{}, fmt.Errorf("%s is an invalid address, ingress rules don't support proxying to a different path on the origin service. The path will be the same as the eyeball request's path", r.Service)
}

Remove the / as suggested by @Cyb3r-Jak3

2 Likes

Ah, thanks. This helped!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.