[SOLVED] Setting Cluster URL in consent app


Hi, am having a problem, it’s not a issue, it’s just consult. I have hydra running in docker in the port 9001, also I have the golang application in the same server, I edited the URL of the cluster to:

sdk.ClusterURL(env.Getenv("HYDRA_CLUSTER_URL", "https://localhost:9001"))

If I let it as HTTP, I mean: "http://localhost:9001" then the consent app gives error connecting with hydra:

Could not connect to Hydra because: Post http://localhost:9001/oauth2/token: malformed HTTP response "\x15\x03\x01\x00\x02\x02\x16"

with https the connection is made, but at the end of all the authentication process I get:

Could not exhange token: Post https://localhost:9001/oauth2/token: x509: certificate signed by unknown authority

If I set the IP of the server and not localhost, I get the same error message. In other hand, I have Caddy in front of the application so there I use proxy to switch to which port redirect the request, as it:

mydomain.com {
    proxy / https:\\localhost:9001 {
      max_fails 1
    log logs/oauth.log

But then if I set:
sdk.ClusterURL(env.Getenv("HYDRA_CLUSTER_URL", "https://mydomain.com"))

I get: Could not connect to Hydra because: oauth2: cannot fetch token: 502 Bad Gateway
Response: 502 Bad Gateway

So, how can I deal with it? I want a simple solution, that’s why I was using localhost as the url. Thank you


You need to skip tls verification which is afaik possible with the sdk.


yes, indeed I already have it, look:

      if client, err = sdk.Connect(
                sdk.ClientID(env.Getenv("HYDRA_CLIENT_ID", "consent-app")),
                sdk.ClientSecret(env.Getenv("HYDRA_CLIENT_SECRET", "consent-secret")),
                sdk.ClusterURL(env.Getenv("HYDRA_CLUSTER_URL", "https://localhost:9001")),


Ok thats weird, maybe its a bug, I will have to check but my schedule is currently very packed and it will not be before 2 or 3 weeks. Maybe ask in the chat if someone can help


Were you able to resolve this or is this still an issue?


Hi! yes, I finally resolved it. Thank you!


If you don’t mind sharing, what solved it?