skillhub/docs/examples/analytics/nginx.conf
小妍儿 ✨ 6952629eed
feat(web): add passive semantic analytics attributes across frontend workflows (#1010)
* feat(web): expose passive semantic analytics attributes

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(web): omit disabled non-native analytics intents

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(web): keep docs integration test outside production build inputs

Move the collector example test alongside existing root-level web tests so the web-only Docker context does not require repository documentation. Preserve all assertions and default Vitest discovery; document the boundary.

Verified 1217 tests, focused 12 tests, typecheck, lint, build and a fresh web-only build without repository docs. Original snapshot reproduced TS2307. Independent review passed. Full local image build was blocked by an uncached pnpm download with network disabled; remote image CI remains authoritative.

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* docs(analytics): configure intent rules and add a manual Umami demo

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(analytics): accept product IDs and preserve concurrent intents

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(analytics): guard consent at Umami dispatch boundary

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(analytics): snapshot validated Umami payload primitives

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* docs(analytics): define configurable opt-in integration

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* chore(analytics): refresh manifest line numbers after main merge

The merge of latest main shifted source lines in router and pages. Only
line numbers change; routes, IDs and sites are identical.

Refs #989

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* fix(analytics): preserve release Web defaults in optional edge

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* docs(analytics): add Chinese guide and split delivery scope

Refs #989

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

* docs(analytics): keep upstream override and bypass module cache in guide

Export the upstream override so later compose commands keep it, and
tell operators to bypass the immutable module cache when re-checking
an edited local entry.

Refs #989

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>

---------

Signed-off-by: 千乘妍 (Xiaoyaner) <258399167+xiaoyaner0201@users.noreply.github.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-10-29 14:56:58 +08:00

85 lines
3.6 KiB
Nginx Configuration File

# OPTIONAL deployment-owned edge template. Not included by SkillHub.
# Demo HTTP listener: publish on loopback only, behind your existing HTTPS edge.
# Substitute only SKILLHUB_WEB_UPSTREAM and UMAMI_UPSTREAM (host:port).
# Merge existing TLS, CSP, authentication, host validation and security headers.
upstream skillhub_analytics_web { server ${SKILLHUB_WEB_UPSTREAM}; }
upstream skillhub_analytics_umami { server ${UMAMI_UPSTREAM}; }
server {
listen 8081;
server_name localhost;
# Preserve the standard Web upload limit on every application proxy route.
client_max_body_size 100M;
# Install ONLY the three .mjs files here, not declarations or other files.
# A single versioned prefix serves the entry AND its relative imports.
location ^~ /_skillhub-observe/v1/ {
root /srv;
try_files $uri =404;
error_page 404 = @module_missing;
autoindex off;
types { application/javascript mjs; }
default_type application/javascript;
add_header X-Content-Type-Options nosniff always;
add_header Cache-Control "public, max-age=31536000, immutable";
}
location @module_missing {
default_type application/javascript;
add_header X-Content-Type-Options nosniff always;
add_header Cache-Control "no-store" always;
return 404 '// module not found\n';
}
location /_skillhub-observe/ { return 404; }
# Expose only two collector endpoints, NEVER Umami's dashboard/admin API.
location = /_skillhub-umami/script.js {
limit_except GET { deny all; }
proxy_pass http://skillhub_analytics_umami/script.js;
proxy_set_header Cookie "";
proxy_set_header Authorization "";
proxy_set_header Referer "";
proxy_hide_header Set-Cookie;
add_header X-Content-Type-Options nosniff always;
}
location = /_skillhub-umami/api/send {
limit_except POST { deny all; }
proxy_pass http://skillhub_analytics_umami/api/send;
proxy_set_header Cookie "";
proxy_set_header Authorization "";
proxy_set_header Referer "";
proxy_hide_header Set-Cookie;
proxy_cache off;
add_header Cache-Control "no-store" always;
}
location /_skillhub-umami/ { return 404; }
# No filtering or cache-policy changes for API, auth, assets, runtime config,
# registry guides/downloads or health. Preserve original URI (no trailing /).
location ~ ^/(api/|oauth2/|login/oauth2/|\.well-known/|assets/|registry/|runtime-config\.js$|nginx-health) {
proxy_pass http://skillhub_analytics_web;
proxy_set_header Host $http_host;
}
# Only UI HTML is eligible; sub_filter's default MIME is text/html.
location / {
proxy_pass http://skillhub_analytics_web;
proxy_set_header Host $http_host;
proxy_set_header Accept-Encoding "";
proxy_set_header If-None-Match "";
proxy_set_header If-Modified-Since "";
proxy_cache off;
proxy_hide_header ETag;
proxy_hide_header Last-Modified;
proxy_hide_header Content-MD5;
proxy_hide_header Cache-Control;
proxy_hide_header Expires;
etag off;
if_modified_since off;
add_header Cache-Control "no-store" always;
# Also prevent the browser's HTTP Referer from leaking page paths/queries.
proxy_hide_header Referrer-Policy;
add_header Referrer-Policy "no-referrer" always;
sub_filter_once on;
sub_filter_last_modified off;
sub_filter '</head>' '<script type="module" src="/_skillhub-observe/v1/observer.mjs"></script></head>';
}
}