Skip to content

Conversation

@kacpersaw
Copy link
Contributor

Add validation to ensure CODER_URL includes http:// or https:// scheme.

Go's url.Parse() accepts URLs without schemes, which causes silent runtime failures when the HTTP client attempts requests with an empty scheme.

Changes

  • Added scheme validation after URL parsing in main.go
  • Added test cases for invalid URL schemes

Before

post log source resource_name=coder-xxx error="Post \"/api/v2/workspaceagents/me/log-source\": unsupported protocol scheme \"\""

After

Error: CODER_URL must include http:// or https:// scheme, got: "coder.example.com"

Add validation to ensure CODER_URL includes http:// or https:// scheme.
Go's url.Parse() accepts URLs without schemes, which causes silent runtime
failures when the HTTP client attempts requests.

This change makes the application fail fast with a clear error message
instead of starting successfully and failing silently at runtime.
@kacpersaw kacpersaw marked this pull request as ready for review February 5, 2026 09:48
@kacpersaw kacpersaw merged commit 3999bae into main Feb 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants