@@ -5262,42 +5262,6 @@ int main(int argc, char ** argv) {
5262
5262
svr->Get (params.api_prefix + " /slots" , handle_slots);
5263
5263
svr->Post (params.api_prefix + " /slots/:id_slot" , handle_slots_action);
5264
5264
5265
- // SPA fallback route - serve index.html for any route that doesn't match API endpoints
5266
- // This enables client-side routing for dynamic routes like /chat/[id]
5267
- if (params.webui && params.public_path .empty ()) {
5268
- // Only add fallback when using embedded static files
5269
- svr->Get (" .*" , [](const httplib::Request & req, httplib::Response & res) {
5270
- // Skip API routes - they should have been handled above
5271
- if (req.path .find (" /v1/" ) != std::string::npos ||
5272
- req.path .find (" /health" ) != std::string::npos ||
5273
- req.path .find (" /metrics" ) != std::string::npos ||
5274
- req.path .find (" /props" ) != std::string::npos ||
5275
- req.path .find (" /models" ) != std::string::npos ||
5276
- req.path .find (" /api/tags" ) != std::string::npos ||
5277
- req.path .find (" /completions" ) != std::string::npos ||
5278
- req.path .find (" /chat/completions" ) != std::string::npos ||
5279
- req.path .find (" /embeddings" ) != std::string::npos ||
5280
- req.path .find (" /tokenize" ) != std::string::npos ||
5281
- req.path .find (" /detokenize" ) != std::string::npos ||
5282
- req.path .find (" /lora-adapters" ) != std::string::npos ||
5283
- req.path .find (" /slots" ) != std::string::npos) {
5284
- return false ; // Let other handlers process API routes
5285
- }
5286
-
5287
- // Serve index.html for all other routes (SPA fallback)
5288
- if (req.get_header_value (" Accept-Encoding" ).find (" gzip" ) == std::string::npos) {
5289
- res.set_content (" Error: gzip is not supported by this browser" , " text/plain" );
5290
- } else {
5291
- res.set_header (" Content-Encoding" , " gzip" );
5292
- // COEP and COOP headers, required by pyodide (python interpreter)
5293
- res.set_header (" Cross-Origin-Embedder-Policy" , " require-corp" );
5294
- res.set_header (" Cross-Origin-Opener-Policy" , " same-origin" );
5295
- res.set_content (reinterpret_cast <const char *>(index_html_gz), index_html_gz_len, " text/html; charset=utf-8" );
5296
- }
5297
- return false ;
5298
- });
5299
- }
5300
-
5301
5265
//
5302
5266
// Start the server
5303
5267
//
0 commit comments