Change http and https ports generates token exchange failed error

Hello,

I am running private instance of the things stack V3 on Ubuntu server. The instance runs fine when I map ports 80 and 443 (http and https for host) in docker-compose.yml. But when I change to ports 8585 and 8586 (http and https for host) I get following error:

{
  "code": 7,
  "message": "error:pkg/web/oauthclient:exchange (token exchange refused)",
  "details": [
    {
      "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
      "namespace": "pkg/web/oauthclient",
      "name": "exchange",
      "message_format": "token exchange refused",
      "correlation_id": "e5bc38fbee2247d194c180fa726416f9",
      "cause": {
        "namespace": "pkg/errors",
        "name": "request",
        "message_format": "request to `{url}` failed",
        "attributes": {
          "op": "Post",
          "url": "https://thethings.pce-service.net/oauth/token"
        },
        "correlation_id": "8e4d754283d943cfad0f7060a167f9e5",
        "cause": {
          "namespace": "pkg/errors",
          "name": "net_operation",
          "message_format": "{message}",
          "attributes": {
            "address": "82.165.125.18:443",
            "message": "dial tcp 82.165.125.18:443: connect: connection refused",
            "net": "tcp",
            "op": "dial",
            "temporary": false,
            "timeout": false
          },
          "correlation_id": "c56837bc5a0b4d8e8ec83b0f1c918870",
          "code": 14
        },
        "code": 14
      },
      "code": 7
    }
  ]
}

I am planning to run other applications on ports 80 and 443. Thus I would like to run the things stack on other ports.

Here is a part of docker-compose,yml

    ports:
      # If deploying on a public server:
      # - "80:1885"
      # - "443:8885"      
      - "8585:1885"
      - "8586:8885"
      - "1881:1881"

Any idea what I might be missing here?

You’ve moved all the ports that the stack is expecting to use.

So you’ll need to add port numbers to all the URLs in ttn-lw-stack-docker.yml

Thank you for the suggestion. I have implemented it and it is working seamlessly.
I have changed the URLs to: https://thethings.example.com:8586
Also thanks for editing the question.