[[embedding]]= Embedding and Integrating CockpitCockpit can be embedded in other web applications either as a whole orspecific Cockpit components can be integrated. Due to frame securitypolicy restrictions, this only works if Cockpit and the web applicationhave the _same origin_; this is commonly achieved by running both from acommon reverse proxy.[[embedding-full]]== Embedding the Cockpit InterfaceCockpit can be embedded into a larger web page as a frame. To embed theentire Cockpit Window use the URI: `+https://server.example.com:9090/+`[source,html]----<html><head><title>Embedded Cockpit</title></head><body>This is Cockpit.<br/><iframe width="800px" height="600px"src="https://server.example.com:9090/"/></body></html>----[[embedding-components]]== Integrating Cockpit Components into Web ApplicationsInstead of embedding the entirety of Cockpit, you can integrate specificcomponents. Only those components explicitly documented as API should beintegrated. Other components can and will change regularly.The component will load from the server in question and a WebSocketconnection will be established with the server to relay the component'smessage stream.Cockpit components are HTML files contained in xref:packages.adoc[packages].These can be placed in an iframe or web browser window. Each documentedand stable component has a well-known URL and these are documented inthe xref:development.adoc[API reference]. Each component URL begins with thestring `+/cockpit/@localhost/+` followed a package name, and then thecomponent itself.For example the xref:api-terminal-html.adoc[terminal.html] in thexref:api-system.adoc[system] package, has this URL:`+/cockpit/@localhost/system/terminal.html+`[source,html]----<html><head><title>Embedded Terminal</title></head><body>This is a terminal.<br/><iframe width="800px" height="600px"src="https://server.example.com:9090/cockpit/@localhost/system/terminal.html"/></body></html>----[[embedding-deep]]== Deep IntegrationMost often link:#embedding-components[simple integration] will be usedto bring Cockpit components into web applications. However it is alsopossible to do deep integration for embedders who wish to performnon-standard authentication with the server, and relay the component'smessage stream to the server themselves.[WARNING]====Deep integration capability is in heavy flux and is not yet documented.====[[embedding-cors]]== Pinging CockpitWhen embedding Cockpit or integrating Cockpit components, it may benecessary to check whether Cockpit is available on a server beforeproceeding.To do this perform a `+/ping+` request to Cockpit. This is a simple HTTPGET request. It returns the following:....GET: https://server.example.com:9090/ping200 OK: { "service": "cockpit" }....The `+/ping+` request allowshttps://en.wikipedia.org/wiki/Cross-origin_resource_sharing[Cross OriginResource Sharing] headers and as such can be performed from Javascriptcode with any origin. The request can also be made via plain HTTPwithout SSL. It is by design that no further information is present inthe response.A complete example of using `+/ping+` is available in the Cockpitsources in the `+/examples/ping-server/+` directory.