Skip to content

DNS-Name to IP resolution support  #779

Open
@JanMikes

Description

Hi, referred to the documentation https://unit.nginx.org/configuration/#proxying, i should be able to proxy request to any valid hostname, but dont know how to do it for docker container, defined and run in the same docker-compose file.

What im trying to do is to proxy all http requests from localhost:8080/.well-known/mercure to the mercure service, but i get 400 response from unit when running put request to config:

/usr/local/bin/docker-entrypoint.sh: Looking for configuration snippets in /docker-entrypoint.d/...
/usr/local/bin/docker-entrypoint.sh: Applying configuration /docker-entrypoint.d/config.json
2022/11/01 21:02:15 [error] 12#12 invalid address "mercure"
/usr/local/bin/docker-entrypoint.sh: Error: HTTP response status code is '400'
{
	"error": "Invalid configuration.",
	"detail": "The \"proxy\" address is invalid \"mercure\""
}

docker-compose.yml (simplified):

version: "3"

services:
    web:
        image: unit
        ports:
            - "8080:8080"

    mercure:
        image: dunglas/mercure

config.json (simplified):

{
    "listeners": {
        "*:8080": {
            "pass": "routes"
        }
    },

    "routes": [
        {
            "match": {
                "uri": "/.well-known/mercure"
            },
            "action": {
                "proxy": "http://mercure"
            }
        }
    ]
}

For "proxy": "http://mercure" i tried different values like mercure, mercure:80, http://mercure:80/ and so on, but nothing worked, the result was the same.

I was able to get it working with traefik, but my goal was to not add additional reverse proxy and having Unit used for that.

If i can provide any further details that would help troubleshooting, please let me know.

Thank you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions