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.
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.
Feature Permissions
Effectively control feature access permissions through user role management. For more information, please refer to the User Management Documentation.
Data Permissions
Control data access through various permission settings:
- Data Connection: Refer to Connection Permissions.
- Application Publishing Permission Control: See Publishing Permission Control.
- Embedded Page Parameter Control: Refer to Publishing Page Embedded Data Filtering Guide.
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:
<iframe src="https://preview.hengshi.com/app" name="export"></iframe>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 on the published pages to obtain the embed link and embed it via iframe. For more details, refer to App Share Embed.
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:
# 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;
}
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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; Secureand 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
csrfCookie andX-CSRF-Token; a cross-origin page cannot read thecsrfCookie from the HENGSHI origin. Prefer Bearer / access-token authentication, or use Option 2. Access-Control-Allow-Headersmust 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 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.
Tip
- Page embedding supports parameters, including data filtering and style customization, which will be elaborated below.
- 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.
- 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.