Skip to content

bug: coder_app produces wrong subdomain url when using subfolders #18572

Open
@daschatten

Description

@daschatten

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Given a python app with fastapi which serves the api docs at http://localhost:8000/docs.

This coder_app:

resource "coder_app" "api" {
  agent_id  = coder_agent.main.id
  slug      = "api"
  icon      = "https://upload.wikimedia.org/wikipedia/commons/a/a6/Api_logo.jpg"
  url       = "http://localhost:8000/docs"
  subdomain = true
  share     = "authenticated"

  healthcheck {
    url       = "http://localhost:8000/ping"
    interval  = 10
    threshold = 30
  }
}

Generates this url:

https://my-subdomain-url/
# Which is redirect to
https://my-subdomain-url/docs

On the server side this happens:

INFO:     10.0.23.3:0 - "GET /docs/ HTTP/1.1" 307 Temporary Redirect
INFO:     10.0.23.3:0 - "GET /docs/docs HTTP/1.1" 404 Not Found

When using url = "http://localhost:8000" and manually appending /docs to generated http link it works fine.

It seems there is an issue with the subdomain url generation.

Relevant Log Output

Expected Behavior

A generated subdomain url which opens the specified subfolder.

Steps to Reproduce

Add coder_app with a subdomain enabled url pointing to a subfolder as above.

Environment

  • Host OS: Ubuntu 22.04
  • Coder version: 2.23.1

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue that require triage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions