Title: bug: Subdomain app and port URLs past the 63-character DNS label limit fail · Issue #32448 · coder/coder · GitHub
Open Graph Title: bug: Subdomain app and port URLs past the 63-character DNS label limit fail · Issue #32448 · coder/coder
X Title: bug: Subdomain app and port URLs past the 63-character DNS label limit fail · Issue #32448 · coder/coder
Description: Problem Subdomain apps and forwarded ports use one DNS label for all their parts: {port}[s]--{agent}--{workspace}--{owner}.apps.example.com {app_slug}--{workspace}--{owner}.apps.example.com RFC 1035 limits a DNS label to 63 characters. U...
Open Graph Description: Problem Subdomain apps and forwarded ports use one DNS label for all their parts: {port}[s]--{agent}--{workspace}--{owner}.apps.example.com {app_slug}--{workspace}--{owner}.apps.example.com RFC 103...
X Description: Problem Subdomain apps and forwarded ports use one DNS label for all their parts: {port}[s]--{agent}--{workspace}--{owner}.apps.example.com {app_slug}--{workspace}--{owner}.apps.example.com RFC 103...
Opengraph URL: https://github.com/coder/coder/issues/32448
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: Subdomain app and port URLs past the 63-character DNS label limit fail","articleBody":"# Problem\n\nSubdomain apps and forwarded ports use one DNS label for all their parts:\n\n```\n{port}[s]--{agent}--{workspace}--{owner}.apps.example.com\n{app_slug}--{workspace}--{owner}.apps.example.com\n```\n\nRFC 1035 limits a DNS label to 63 characters. Usernames and workspace names can each have 32 characters. A long port URL therefore passes the limit when the agent, workspace, and owner names together have more than 51 characters (with port 65535s). A suffix wildcard such as *--apps.example.com makes the limit lower.\n\nWhen the label is too long:\n\n- Browsers and resolvers reject the hostname, so the app or port does not open.\n- Wildcard TLS certificates do not match.\n- Shared port links from https://github.com/coder/coder/pull/11486 do not work for these users.\n\nAdministrators cannot fix this, because users choose the names. Shorter name limits would break existing users.\n\n# Proposal\n\nKeep the current URL when it fits. Use a short form, which identifies the workspace by ID, when it does not fit:\n\n| Kind | Short form | Length |\n|--------|--------|--------|\n| Port | {port}[s]--{workspace_id}--{agent_hash} | 42 characters or fewer |\n| App | {app_slug}--{workspace_id} | slug + 27 characters |\n\n- workspace_id is the workspace UUID in base36, 25 characters. The workspace ID does not change when the workspace restarts. (Agent IDs change on each build, so they are not used.)\n- agent_hash is the 32-bit FNV-1a hash of the agent name in base36, 7 characters. Only ports need it, because app slugs are unique in a workspace.\n- The parser tells the forms apart by the number of parts. A long port URL has 4 parts and a long app URL has 3 or 4 parts. Neither can have the short form shape (port with 3 parts, or app with 2 parts).\n- For ports, Coder decides the form with the longest port (65535s). All ports of an agent then use the same form, so the {{port}} template in VSCODE_PROXY_URI stays correct.\n\n# Resolution\n\n1. Get the workspace by ID. Get the owner from the workspace.\n2. For ports, hash each agent name in the latest build and find the match. Reject the request if 0 or 2 or more agents match.\n3. Apply the same RBAC and port share checks as the long form.\n\n# Security notes\n\n- SignedToken.MatchesRequest must compare the agent hash. If not, a token for port 8080 on agent A also matches port 8080 on agent B.\n- WorkspaceAppCors compares owner usernames today. A short form URL has no username, so it must only allow origins in the same workspace. If not, two short form apps of different users match, because both usernames are empty.\n\n# Compatibility\n\n- URLs that fit today do not change, so bookmarks, OAuth redirect URIs, and CORS allow lists still work.\n- An older external workspace proxy cannot parse short form URLs. Upgrade proxies together with coderd.\n- The decision uses the primary wildcard hostname. A workspace proxy with a longer fixed wildcard part can still get a long form URL that does not fit there.\n- Coder logs a startup warning when the fixed part of the first wildcard label is longer than 21 characters, because then even the short form can pass the limit.\n\n# Alternatives\n\n| Option | Why not |\n|--------|--------|\n| Multi-level subdomains (8080.agent.ws.user.apps.example.com) | A wildcard TLS certificate covers one level only. |\n| Path-based port URLs | No origin isolation between apps. This is why path-based ports are blocked today. |\n| Shorter name limits | Breaking change. Even 16-character names do not leave room. |\n| Random slug stored in a new table | Needs a migration, a lookup on each request, and cleanup. The workspace ID gives the same result without new state. |\n| Cell | Agent IDs change on each workspace build, so links break after a restart. | \n| Short form always | Changes every existing URL and breaks OAuth callbacks and CORS settings in outside systems. |\n\n# Reference implementation\n\nA draft implementation with tests is here: https://github.com/coder/coder/pull/32447\n\nIt changes `coderd/workspaceapps/appurl`, the request resolver, token matching, CORS, db2sdk, the agent manifest, toolsdk, and the frontend portForwardURL helper. Go and TypeScript tests use the same test values so that the two copies of the algorithm stay the same.","author":{"url":"https://github.com/eimhin-rover","@type":"Person","name":"eimhin-rover"},"datePublished":"2026-11-19T14:35:10Z","url":"https://github.com/coder/coder/issues/32448"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a48aeb73-39bf-e478-7457-4a6c696d14dd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A7A0:1D9B81:AABDB:EC13B:6B042DC2 |
| html-safe-nonce | 4d5815fb86db819e0c1e6225fb9af30d4398e608c8307458b6b17f3d36654224 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0EwOjFEOUI4MTpBQUJEQjpFQzEzQjo2QjA0MkRDMiIsInZpc2l0b3JfaWQiOiIzMTc5ODA3OTAxNTY5MjY1MDkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d2a3be70f6aa85835ab5f46ffb6aa660f165400ba179bc6121af3bc85e4511b4 |
| hovercard-subject-tag | issue:6491952120 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/32448/issue_layout |
| twitter:image | https://opengraph.githubassets.com/82841d4b01f9153c80f9a08b32693d00e83360947f56d766aa67e565ed62dc99/coder/coder/issues/32448 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/82841d4b01f9153c80f9a08b32693d00e83360947f56d766aa67e565ed62dc99/coder/coder/issues/32448 |
| og:image:alt | Problem Subdomain apps and forwarded ports use one DNS label for all their parts: {port}[s]--{agent}--{workspace}--{owner}.apps.example.com {app_slug}--{workspace}--{owner}.apps.example.com RFC 103... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eimhin-rover |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width