systemprompt_api/services/middleware/session/
skip.rs1use systemprompt_models::modules::ApiPaths;
7
8pub fn should_skip_session_tracking(path: &str) -> bool {
9 if path.starts_with(ApiPaths::TRACK_BASE) {
10 return false;
11 }
12
13 if path.starts_with(ApiPaths::MCP_BASE) {
14 return true;
15 }
16
17 if path.starts_with(ApiPaths::API_BASE) {
18 return true;
19 }
20
21 if path.starts_with(ApiPaths::NEXT_BASE) {
22 return true;
23 }
24
25 if path.starts_with(ApiPaths::STATIC_BASE)
26 || path.starts_with(ApiPaths::ASSETS_BASE)
27 || path.starts_with(ApiPaths::IMAGES_BASE)
28 {
29 return true;
30 }
31
32 if path == "/health" || path == "/ready" || path == "/healthz" {
33 return true;
34 }
35
36 if path == "/favicon.ico"
37 || path == "/robots.txt"
38 || path == "/sitemap.xml"
39 || path == "/manifest.json"
40 {
41 return true;
42 }
43
44 if let Some(last_segment) = path.rsplit('/').next()
45 && last_segment.contains('.')
46 {
47 let extension = last_segment.rsplit('.').next().unwrap_or("");
48 match extension {
49 "html" | "htm" => {},
50 _ => return true,
51 }
52 }
53
54 false
55}