feat(middleware): add cache control middleware to manage response caching for image files

This commit is contained in:
Will Miao
2025-09-16 15:05:31 +08:00
parent 64e1dd3dd6
commit 30956aeefc
3 changed files with 55 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ from pathlib import Path
import os
import sys
import json
from middleware.cache_middleware import cache_control
# Create mock modules for py/nodes directory - add this before any other imports
def mock_nodes_directory():
@@ -129,7 +130,7 @@ class StandaloneServer:
"""Server implementation for standalone mode"""
def __init__(self):
self.app = web.Application(logger=logger)
self.app = web.Application(logger=logger, middlewares=[cache_control])
self.instance = self # Make it compatible with PromptServer.instance pattern
# Ensure the app's access logger is configured to reduce verbosity