Skip to content

Port is missing when port-forwarding via Dashboard #8189

Closed

Description

@jizusun

Environment variables:

CODER_ACCESS_URL=http://coder.example.com:3000
CODER_HTTP_ADDRESS=0.0.0.0:3000
CODER_WILDCARD_ACCESS_URL=*.coder.example.com

The URL should be

+http://3000--main--jizu--jizu.example.com:3000
-http://3000--main--jizu--jizu.example.com

image

Activity

  1. matifali commented on Jun 26, 2023

    @matifali
    Contributor

    Looks like a bug. Thanks for reporting.
    Generally, when hosting Coder on a subdomain, specify CODER_ACCESS_URL without the port and use a reverse proxy to route your subdomain to the port where the Coder service is running.

  2. kylecarbs commented on Jun 26, 2023

    @kylecarbs
    Member

    @Emyrk I believe this might be a regression with proxies...

  3. Emyrk commented on Jun 26, 2023

    @Emyrk
    Member

    @kylecarbs will take a look

  4. Emyrk commented on Jun 26, 2023

    @Emyrk
    Member

    Has this ever worked? There is a mistake in the configuration. The CODER_WILDCARD_ACCESS_URL value does not have the port.

    The CODER_ACCESS_URL value does not have any impact on those URLs. Only the CODER_WILDCARD_ACCESS_URL.

    So CODER_WILDCARD_ACCESS_URL should be *.example.com:3000 not `*.example.com.


    That being said, we do not allow a port in the wildcard access url for two reasons.

    First the flag parser:

    uu, err := url.Parse(v)

    Second the HostnamePattern check:

    coder/coderd/httpapi/url.go

    Lines 103 to 105 in 1406838

    if strings.Contains(pattern, ":") {
    return nil, xerrors.Errorf("hostname pattern must not contain a port: %q", pattern)
    }

    So I don't think we have ever allowed a port in the wildcardurl. I do not know why, so we might be able to just allow it?

  5. Emyrk commented on Jun 26, 2023

    @Emyrk
    Member

    In the current state, if you wish to use a CODER_WILDCARD_ACCESS_URL, you must use a domain without a port.

  6. jizusun commented on Jun 29, 2023

    @jizusun
    Author

    Thank you @Emyrk

    Currently there is another process listening on the port 80 on that machine.

    Is the possible that I can make the port-forwarding via dashboard work with port 3000?

  7. matifali commented on Jun 29, 2023

    @matifali
    Contributor

    You could try hosting Coder behind a Revere proxy.
    See https://github.com/coder/coder/tree/main/examples/web-server for examples.

  8. Emyrk commented on Jun 29, 2023

    @Emyrk
    Member

    In the current state, if you wish to use a CODER_WILDCARD_ACCESS_URL, you must use a domain without a port.

    @deansheather do you know if this not using a port on wildcard domains is a requirement?

  9. added
    s1Bugs that break core workflows. Only humans may set this.
    on Aug 7, 2023
  10. bpmct commented on Aug 7, 2023

    @bpmct
    Member

    In the current state, if you wish to use a CODER_WILDCARD_ACCESS_URL, you must use a domain without a port.

    Let's read the port from the access URL itself to fix this. I believe this is how we handle it in Coder v1 (our legacy product)

  11. added
    s3Bugs that confuse, annoy, or are purely cosmetic
    and removed
    waiting-for-infoThe issue creator is asked to provide more information.
    s1Bugs that break core workflows. Only humans may set this.
    on Aug 7, 2023
  12. deansheather commented on Aug 7, 2023

    @deansheather
    Collaborator

    Instead of allowing the wildcard access URL to have a port we should just append the port from the access URL to the URL. We expect them to be served on the same port on the same host.

  13. Emyrk commented on Aug 7, 2023

    @Emyrk
    Member

    Should we expect them to be on the same port? That seems like an assumption that won't always hold true.

  14. bpmct commented on Aug 31, 2023

    @bpmct
    Member

    I think the assumption is fair. It is what we do in Coder v1.

  15. Emyrk commented on Aug 31, 2023

    @Emyrk
    Member

    Why can we not just allow the wildcard url to have a port though? Am I missing something why we can't just allow that?

  16. bpmct commented on Aug 31, 2023

    @bpmct
    Member

    Oh, I'm down for either!

  17. VaalaCat commented on Oct 28, 2023

    @VaalaCat

    Is there any progress on this issue?

  18. crono782 commented on Jan 5, 2024

    @crono782

    Ran into this same issue. Hoping there will be some traction on this issue soon. The forwarded port seems to show correctly in code-server list of forwarded ports, but not in the dashboard. Trying to force it yields errors.

  19. self-assigned this
    on Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

s3Bugs that confuse, annoy, or are purely cosmetic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions