Server host configuration was ignored #15

Closed
opened 2025-08-24 18:32:22 +02:00 by olemd · 1 comment
Owner

Description

The server 'host' field in configuration was completely ignored, causing the server to always bind to all interfaces (0.0.0.0) regardless of the configured host value.

Issue Details

  • Configuration had field but it was never used
  • NewServer() only accepted port parameter, ignored host
  • Server always bound to format instead of
  • Users couldn't bind to localhost-only or specific interfaces

Root Cause

  • NewServer() function signature missing host parameter
  • Server struct missing host field
  • Addr formation in http.Server hardcoded to

Solution Implemented

  1. Added host field to Server struct
  2. Updated NewServer() to NewWebServer() with host parameter
  3. Fixed http.Server.Addr to use format
  4. Updated startup message to show actual bind address
  5. Handle empty host (bind to all interfaces) vs specific host

Testing

  • Empty host: binds to all interfaces (0.0.0.0:port)
  • 'localhost' or '127.0.0.1': binds to local only
  • '::1': binds to IPv6 localhost
  • Specific IP: binds to that interface only

Files Changed

  • internal/server/server.go - Server struct and constructor
  • cmd/skyview/main.go - Function call and startup message

This was a significant configuration bug that prevented localhost-only deployment.

## Description The server 'host' field in configuration was completely ignored, causing the server to always bind to all interfaces (0.0.0.0) regardless of the configured host value. ## Issue Details - Configuration had field but it was never used - NewServer() only accepted port parameter, ignored host - Server always bound to format instead of - Users couldn't bind to localhost-only or specific interfaces ## Root Cause - NewServer() function signature missing host parameter - Server struct missing host field - Addr formation in http.Server hardcoded to ## Solution Implemented 1. Added host field to Server struct 2. Updated NewServer() to NewWebServer() with host parameter 3. Fixed http.Server.Addr to use format 4. Updated startup message to show actual bind address 5. Handle empty host (bind to all interfaces) vs specific host ## Testing - Empty host: binds to all interfaces (0.0.0.0:port) - 'localhost' or '127.0.0.1': binds to local only - '::1': binds to IPv6 localhost - Specific IP: binds to that interface only ## Files Changed - internal/server/server.go - Server struct and constructor - cmd/skyview/main.go - Function call and startup message This was a significant configuration bug that prevented localhost-only deployment.
Author
Owner

Fixed in commit 0d60592:

Server Host Binding Issue Resolved

Root Cause:

  • Server host configuration field was completely ignored
  • NewServer() only accepted port parameter, missing host
  • IPv6 addresses weren't properly formatted with brackets

Fix Applied:

  1. Added host field to Server struct
  2. Renamed NewServer() to NewWebServer() with host parameter
  3. Fixed address formatting for IPv6: bracketed format instead of bare address
  4. Updated startup message to show correct bind address
  5. Handle all binding scenarios properly

Testing:

  • IPv6 localhost: bracketed format
  • IPv4 localhost: direct binding
  • Hostname: standard format
  • All interfaces: wildcard (empty host)

The 'too many colons in address' error for IPv6 hosts is now resolved.

Fixed in commit 0d60592: Server Host Binding Issue Resolved Root Cause: - Server host configuration field was completely ignored - NewServer() only accepted port parameter, missing host - IPv6 addresses weren't properly formatted with brackets Fix Applied: 1. Added host field to Server struct 2. Renamed NewServer() to NewWebServer() with host parameter 3. Fixed address formatting for IPv6: bracketed format instead of bare address 4. Updated startup message to show correct bind address 5. Handle all binding scenarios properly Testing: - IPv6 localhost: bracketed format - IPv4 localhost: direct binding - Hostname: standard format - All interfaces: wildcard (empty host) The 'too many colons in address' error for IPv6 hosts is now resolved.
olemd closed this issue 2025-08-24 18:37:02 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: olemd/skyview#15
No description provided.