---
url: /v7.0/en-us/embed.md
---
# HENGSHI SENSE Embedded Data Analysis Solution

HENGSHI SENSE provides a powerful embedded data analysis solution. This document will detail various features and integration options.

## Account Integration

By integrating the SSO authentication method, unified authentication for application identity and user identity is achieved, providing secure and reliable user identity authentication and transmission. For more details, please refer to [SSO Documentation](../authorization.md).

## Single Sign-On

Simplify user authentication across applications using SSO, providing a seamless and secure user experience. For implementation details, refer to the [SSO Documentation](../authorization.md).

## Feature Permissions

Effectively control feature access permissions through user role management. For more information, please refer to the [User Management Documentation](../user-role.md).

## Data Permissions

Control data access through various permission settings:

* Data Connection: Refer to [Connection Permissions](../connection-permission.md).
* Application Publishing Permission Control: See [Publishing Permission Control](app-data-auth.md).
* Embedded Page Parameter Control: Refer to [Publishing Page Embedded Data Filtering Guide](url-where.md).

## Embedding Creation Pages

Embed HENGSHI product links into an iframe and add the attribute `name="export"`.

For example, to embed `https://preview.hengshi.com/app`, use the following code:

```html
<iframe src="https://preview.hengshi.com/app" name="export"></iframe>
```

> \[!TIP] Tip
> Creation area pages do not support mobile embedding.

## Embed Published Pages

* Supports embedding methods similar to those in the creation area pages.
* Use the [Share Button](../publish-analyst-share-embed.md) on the published pages to obtain the embed link and embed it via iframe. For more details, refer to [App Share Embed](../publish-analyst-share-embed.md).

> \[!TIP] Tip
> Published pages support responsive design.

## Multiple business systems and cross-origin configuration

When one HENGSHI deployment is embedded by multiple business systems (dashboard iframes, published pages, Data Agent / SDK, and so on), browser cross-origin and Cookie restrictions apply regardless of the embedding form; handle them with this section.

One HENGSHI deployment can configure only one `SECURITY_CORS_CONFIG_ACCESS_CONTROL_ALLOW_ORIGIN`. When multiple business systems connect at the same time, choose one of the following approaches.

### Option 1: whitelist and echo origins at the HENGSHI ingress

Use an ingress Nginx to strip the CORS headers returned by HENGSHI and echo the request `Origin` when it matches a whitelist. The configuration below has been verified for multiple origins, preflight, and header de-duplication; replace IPs and ports with site values:

```nginx
# http block
map $http_origin $hs_cors_origin {
    default "";
    "http://10.20.0.11:8080" $http_origin;
    "http://10.20.0.12:8090" $http_origin;
}
map $hs_cors_origin $hs_cors_credentials {
    default "true";
    "" "";
}

server {
    listen 18080;

    location / {
        # Strip HENGSHI CORS headers to avoid duplicates
        proxy_hide_header Access-Control-Allow-Origin;
        proxy_hide_header Access-Control-Allow-Credentials;
        proxy_hide_header Access-Control-Allow-Methods;
        proxy_hide_header Access-Control-Allow-Headers;
        proxy_hide_header Access-Control-Max-Age;

        add_header Access-Control-Allow-Origin $hs_cors_origin always;
        add_header Access-Control-Allow-Credentials $hs_cors_credentials always;
        add_header Access-Control-Allow-Methods "GET, HEAD, POST, PUT, DELETE, OPTIONS" always;
        add_header Access-Control-Allow-Headers "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, Authorization, X-CSRF-Token, X-Request-Domain, X-Request-Hash-Url, X-Request-Proxy" always;
        add_header Access-Control-Max-Age 600 always;
        add_header Vary Origin always;

        # Answer preflight directly; the headers above still apply
        if ($request_method = OPTIONS) {
            return 204;
        }

        # Streaming interfaces such as Data Agent need buffering off and a longer read timeout
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_buffering off;
        proxy_cache off;
        proxy_read_timeout 3600s;

        proxy_pass http://10.20.0.40:8080;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
```

Point each business system's embed URL and SDK / API address at this Nginx ingress. A whitelisted origin receives itself; an unmatched origin receives no `Access-Control-Allow-Origin`. With credentials, that header must be one explicit origin, and dynamic echo still requires `Vary: Origin`.

Before using this approach:

* The business page and the ingress must use the same protocol; an HTTPS page cannot call an HTTP ingress.
* When the business system and HENGSHI use different IPs and rely on Cookies, the browser treats the request as cross-site. Over HTTP, Cookies are not sent; use HTTPS with `SameSite=None; Secure` and verify the browser's third-party Cookie policy.
* Only the one origin configured in HENGSHI is exempt from CSRF. POST/PUT from other origins require the `csrf` Cookie and `X-CSRF-Token`; a cross-origin page cannot read the `csrf` Cookie from the HENGSHI origin. Prefer Bearer / access-token authentication, or use Option 2.
* `Access-Control-Allow-Headers` must cover every header the SDK actually sends; keep the system defaults and add what is needed.

### Option 2: give each business system a same-origin subpath proxy

Add a `/hengshi/` reverse proxy under each business system's own entry so the browser keeps the same scheme, IP, and port; use each `/hengshi/` path for embed URLs and the SDK. This avoids cross-origin CORS and third-party Cookies.

Follow [secondary path access](../install-configure.md#二级访问路径配置) and use `sub_filter` to rewrite `<base href="/">`, disabling upstream compression with `proxy_set_header Accept-Encoding ""`. The `CONTEXT_PATH` parameter no longer takes effect in this release and cannot provide a secondary path.

## API Support

The HENGSHI system supports a client-mode RESTful Open API. For detailed API documentation, please refer to the [API Documentation](https://api.hengshi.com).

> \[!TIP] Tip
>
> 1. Page embedding supports parameters, including data filtering and style customization, which will be elaborated below.
> 2. The required API list should be considered from a product perspective. It is recommended to adopt page integration as much as possible to avoid API complexity.
> 3. Regarding user roles and user groups, the integrator needs to consider functional permission issues: synchronizing user information to the HENGSHI system; user registration/deletion will trigger HENGSHI API calls; user role modification; coordination of user groups.
