Support for Multiple Beacon Sites with Distinct Domains and Shared Root Path (/
) in Single-App Configuration
#721
Labels
/
) in Single-App Configuration
#721
Is your feature request related to a problem? Please describe
Currently, in a single-app configuration, Beacon does not support having two distinct beacon sites, each distinguished by a different host, when both point to the root path (
/
) within the router scope. For example, the following configuration works when each site has a distinct path:However, the following configuration is not supported, where both sites share the root path (
/
):This limitation means that it is impossible, if you need to deploy a single-app project, to have two or more distinct domains/subdomains (e.g.,
https://example1.com/
andhttps://example2.com/
) pointing to their respective Beacon sites without including the page name in the URL.Describe the solution you'd like
Introduce a new configuration option,
site_domain
, in the Beacon site configuration withinruntime.exs
. This option allows specifying the domain (e.g.,"example1.com"
), which will be set as thehost
in the router scope for that site. With this enhancement, sites configured withsite_domain
will function independently, even with the root path (/
).If
site_domain
is not set, the behavior remains unchanged, maintaining backward compatibility.Additional Context
The site_domain option will be matched against its value in the reachability test
Beacon.Router.reachable?
. If it succeeds, the site will be bootedExample Configuration
With this enhancement, the URLs
https://example1.com/
andhttps://example2.com/
will correctly point to their respective Beacon sites. The proposed feature is fully backward compatible.If you'd like, I'm ready to submit a PR (https://github.com/guidotripaldi/beacon/tree/add-site-domain) for this feature. Please let me know if any adjustments are needed for the PR.
The text was updated successfully, but these errors were encountered: