Skip to content

fix(apache): default vhost port so vhosts bind an address - #98

Merged
ashish1099 merged 1 commit into
masterfrom
fix/apache-vhost-port-servername
Sep 2, 2026
Merged

fix(apache): default vhost port so vhosts bind an address#98
ashish1099 merged 1 commit into
masterfrom
fix/apache-vhost-port-servername

Conversation

@Aman1994

@Aman1994 Aman1994 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

port is Optional in Eit_types::Web::Apache::Vhost_options, and the profile passed it straight to apache::vhost. When unset, apache::vhost falls back to the resource title for the vhost address, emitting <VirtualHost keyserver_webapp>. Apache cannot resolve that as an address and drops the vhost entirely:

AH00547: Could not resolve host name keyserver_webapp -- ignoring!

Every request then falls through to the default vhost. Hit in prod on dkcphcochlear0{1,2}: the keyserver app vanished and clients got the default docroot's directory index.

Default the port to 443/80 based on ssl, and use it in three places:

  • apache::vhost's port, which is the actual fix
  • the $listen_ports map, so a portless vhost still opens its firewall port instead of relying on $https/$http happening to cover it
  • monitor::domains, which was building https://host: with a trailing colon whenever port was unset

Also add an optional servername passthrough. It defaults to the resource title, which is rarely a resolvable hostname, so a vhost named for the app rather than the site never matches a real Host: header. Leaving it undef keeps the previous behaviour.

@Aman1994 Aman1994 changed the title fix(apache): default vhost port so vhosts bind an address WIP: fix(apache): default vhost port so vhosts bind an address Sep 1, 2026
`port` is Optional in Eit_types::Web::Apache::Vhost_options, and the
profile passed it straight to apache::vhost. When unset, apache::vhost
falls back to the resource title for the vhost address, emitting
`<VirtualHost keyserver_webapp>`. Apache cannot resolve that as an
address and drops the vhost entirely:

  AH00547: Could not resolve host name keyserver_webapp -- ignoring!

Every request then falls through to the default vhost. Hit in prod on
dkcphcochlear0{1,2}: the keyserver app vanished and clients got the
default docroot's directory index.

Default the port to 443/80 based on `ssl`, and use it in three places:

- apache::vhost's `port`, which is the actual fix
- the $listen_ports map, so a portless vhost still opens its firewall
  port instead of relying on $https/$http happening to cover it
- monitor::domains, which was building `https://host:` with a trailing
  colon whenever port was unset

Also add an optional `servername` passthrough. It defaults to the
resource title, which is rarely a resolvable hostname, so a vhost named
for the app rather than the site never matches a real Host: header.
Leaving it undef keeps the previous behaviour.
@Aman1994
Aman1994 force-pushed the fix/apache-vhost-port-servername branch from e73c1ad to fd97b87 Compare September 2, 2026 04:15
@Aman1994
Aman1994 marked this pull request as draft September 2, 2026 04:21
@Aman1994
Aman1994 force-pushed the fix/apache-vhost-port-servername branch from 416f550 to fd97b87 Compare September 2, 2026 09:14
@Aman1994
Aman1994 marked this pull request as ready for review September 2, 2026 09:35
@Aman1994 Aman1994 changed the title WIP: fix(apache): default vhost port so vhosts bind an address fix(apache): default vhost port so vhosts bind an address Sep 2, 2026
@ashish1099
ashish1099 merged commit f15c096 into master Sep 2, 2026
1 check passed
@ashish1099
ashish1099 deleted the fix/apache-vhost-port-servername branch September 2, 2026 09:43
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