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