| 1 |
[[urls]] |
| 2 |
= Cockpit URLs |
| 3 |
|
| 4 |
Cockpit URLs follow a specific structure, related to the components they |
| 5 |
are loading. Various components are loaded in `+<iframe>+` tags. The |
| 6 |
URLs for these components are described first. Further down below you |
| 7 |
can find information about the top level bookmarkable Cockpit address |
| 8 |
URLs. |
| 9 |
|
| 10 |
[[urls-components]] |
| 11 |
== Component URLs |
| 12 |
|
| 13 |
Cockpit components are HTML documents. They are organized into |
| 14 |
xref:packages.adoc[packages]. Each package contains information about which |
| 15 |
HTML components are available in that package. Components should always |
| 16 |
use relative URLs to access resources, such as images, scripts or CSS |
| 17 |
files, even if they refer to a resource in another package. |
| 18 |
|
| 19 |
The following are valid component URLs, each bit will be discussed |
| 20 |
below: |
| 21 |
|
| 22 |
.... |
| 23 |
/cockpit/@localhost/package/component.html#/hash |
| 24 |
/cockpit/$checksum/package/component.html#/hash |
| 25 |
/cockpit/@server.example.com/package/component.html#/hash |
| 26 |
/cockpit+embedder/@localhost/package/component.html#/hash |
| 27 |
.... |
| 28 |
|
| 29 |
All resource URLs are under the `+/cockpit+` namespace. In cases where a |
| 30 |
Cockpit component is being xref:embedding.adoc[embedded] the `+/cockpit+` |
| 31 |
may be followed by a plus sign and another `+embedder+` specific |
| 32 |
identifier. |
| 33 |
|
| 34 |
What follows is either a `+@host+` or `+$checksum+` which tells cockpit |
| 35 |
where to xref:packages.adoc[find the package]. Checksums are used when more |
| 36 |
than one host has identical packages and the resources can be cached. |
| 37 |
|
| 38 |
The `+package+` name is next, followed by the `+component+` HTML path |
| 39 |
inside that package. And lastly a hash allows for navigation within a |
| 40 |
single component. The hash should follow a URL path and/or query string |
| 41 |
form. |
| 42 |
|
| 43 |
[WARNING] |
| 44 |
==== |
| 45 |
Never assume that the `+@host+` or `+$checksum+` portion is predictable. |
| 46 |
Only refer to resources in packages on the same host. |
| 47 |
==== |
| 48 |
|
| 49 |
[[urls-visible]] |
| 50 |
== Visible URLs |
| 51 |
|
| 52 |
The above Component URLs are usually not visible to the user. Instead |
| 53 |
the Cockpit Web Service wraps the components in a shell which allows |
| 54 |
navigation, and provides bookmarkable clean URLs to the component. These |
| 55 |
URLs do not affect xref:embedding.adoc[embedders] or |
| 56 |
xref:packages.adoc[components] directly. |
| 57 |
|
| 58 |
If no path is present then the Cockpit will redirect to the default page |
| 59 |
for the server. |
| 60 |
|
| 61 |
If the first segment of the path begins with an `+@+` sign, then the |
| 62 |
component is being shown from a non-local host. |
| 63 |
|
| 64 |
The next segment of the path, (or first if the component is being shown |
| 65 |
on the local host) is the xref:packages.adoc[package name]. The remainder of |
| 66 |
the path is a component file in the package. If no further path segments |
| 67 |
are present, a default `+index.html+` component in the package is |
| 68 |
loaded. An extension of `+.html+` is automatically appended. |
| 69 |
|
| 70 |
The hash portion of the path is automatically transferred to the |
| 71 |
component as the hash of its link:#urls-components[resource URL]. |