> Source: https://docs.cyberelements.io/bastion/4.7/pt/Usage/Administration/SystemConsole/VirtualHosts/

# Virtual hosts

**Virtual hosts** decide through where and under which names the platform is reached. Three stacked grids, and they do not talk about the same thing: the first says on which addresses and ports the web server listens, the second what it publishes under each name, the third serves an entirely different purpose.

![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_SystemConsole_VirtualHosts_Tabs.png)

## Web interface and web virtual host: the pair to understand

A **web interface** is a listening point: an address and a port. A **web virtual host** is what the server publishes under a given access name: the user portal, the administration console, the system console, possibly a reverse proxy.

The two meet **inside the web interface**: it is by editing an interface that one chooses the virtual hosts it activates. There is therefore never any need to "attach" a virtual host to an interface from the virtual host grid: the attachment is made in one direction only.

> **Deleting a web virtual host requires no prior detachment**
>
> A deleted virtual host is **automatically removed** from the web interfaces that activated it. Contrary to what the stacking of the three grids suggests, there is nothing to undo first.

## What is special about `default`

Each of the three grids carries an entry named **default**, and none of the three can be deleted.

> **A selection containing default can no longer be deleted at all**
>
> The delete button is greyed out as soon as the selection includes a `default` entry, even if it includes others that are perfectly deletable. Remove `default` from the selection before deleting the rest.

> **The default virtual host of the default interface cannot be deactivated**
>
> In the `default` web interface, the `default` row can neither be removed nor unticked: the click has no effect, and no message. And if one tries to save the `default` interface without it, saving is refused with *The default virtual host must be enabled to ensure the operation of the default web interface*.

> **A second SSL virtual host named default is silently renamed**
>
> Creating an SSL entry under the name `default` saves it as `other_default`, without warning. Likewise, renaming the existing `default` entry has no effect: it keeps its name.

## The three types of web virtual host

The type is chosen at creation and commands the rest of the form.

- **Web VPN**: the publishing mode of the platform itself (user portal, administration console, system console).
- **Reverse Proxy** and **Transparent Reverse Proxy**: the publishing of a third-party application through the platform.

> **The system console must stay published somewhere**
>
> A Web VPN virtual host publishes the three portals by default, and the system console checkbox carries a warning in red: it must be published on at least one available virtual host. **That warning is backed by no check at all**: unticking the box everywhere is accepted, and closes the door to the system console. That is the mistake not to make on this screen.

## SSL virtual hosts are not a third layer

The third grid does not extend the first two: it shares no data with them. It is a **correspondence table** between the web address through which the user arrives and the address to give to the access client for its connections. The `default` entry is the fallback used when no address matches.

That is also why nothing restarts there: a change is taken into account immediately, without touching the web server.

## Every write on the first two grids restarts the web server

> **Sessions in progress are interrupted**
>
> Adding, modifying or deleting a **web interface** or a **web virtual host** triggers a restart of the web server, announced by a *Web server restart* overlay. Carry out these operations during a maintenance window. The third grid does not have that effect.

## What can no longer be changed after creation

The **name of a web interface** (its address and its port) can no longer be modified: it becomes plain displayed text. Changing the listening point means creating an interface and deleting the old one.

The name and the type of a **web virtual host**, on the other hand, stay modifiable.

## What the cluster changes

On a cluster, the web interface window additionally offers to choose on which node the interface exists (master, slave or both) and the list of addresses offered is that of the two nodes and of the virtual addresses declared in [Cluster settings](https://docs.cyberelements.io/bastion/4.7/pt/Usage/Administration/SystemConsole/ClusterSettings/). On a standalone server these choices do not appear.

> **A mode change resets the virtual hosts**
>
> The [Switch mode](https://docs.cyberelements.io/bastion/4.7/pt/Usage/Administration/SystemConsole/SwitchMode/) confirmation window says so explicitly: any change to the cluster configuration resets the virtual hosts. Write them down before, and redo them after.

## Limits

- The virtual host to interface attachment is made only from the web interface.
- The listening point of an interface cannot be modified.
- The `default` entries of the three grids cannot be deleted, and the one in the `default` interface cannot be deactivated.
- Nothing checks that a host publishing the system console stays available.
- Deleting an SSL virtual host named `default` is reported as successful although nothing is deleted.

---

The detail of the three grids and of their windows is in the [module reference](https://docs.cyberelements.io/bastion/4.7/pt/Usage/Reference/SystemConsole/VirtualHosts/), and the related procedures in [Add a DNS name authorised to connect to the Web interfaces](https://docs.cyberelements.io/bastion/4.7/pt/Usage/Configuration/SystemConsole/AddAllowedDNSName/) and [Configuring the SSL Router Address Announcement](https://docs.cyberelements.io/bastion/4.7/pt/Usage/Configuration/SystemConsole/ConfigureVirtualhostSSL/).

The API endpoints that drive this object are described in the [API reference](https://docs.cyberelements.io/bastion/4.7/pt/API/APIGuide/#get-/publicapi/virtualhosts/).
