Skip to main content

Module hosts

Module hosts 

Source
Expand description

/etc/hosts management for the reverse proxy.

Automatically syncs registered slug hostnames into /etc/hosts so that browsers can resolve them (needed for Safari, which doesn’t auto-resolve .localhost subdomains, and for custom TLDs like .test).

Entries are managed inside a marked block delimited by # pitchfork-start / # pitchfork-end. The block is replaced on each sync and removed entirely on proxy shutdown.

Functions§

clean_hosts_file
Remove the pitchfork-managed block from /etc/hosts.
sync_hosts_file
Sync all registered slug hostnames into /etc/hosts.
sync_hosts_from_settings
Refresh /etc/hosts from the current settings if sync is enabled.