HTTP Server
Response Control (404 Hijacking)
Global mechanism to intercept and customize unhandled routes with custom logic, status codes, and content.
Disabled by Default
Response Control is inactive by default. When disabled, XyPriss utilizes the standard
notFound template handler.Configuration
Basic Content Hijack
typescript
const app = createServer({
responseControl: {
enabled: true,
statusCode: 404,
content: { error: "Resource Not Found", code: "ERR_404" },
contentType: "application/json"
}
});Custom Handler Logic
typescript
responseControl: {
enabled: true,
handler: (req, res) => {
logger.warn(`Intrusion attempt or 404 at ${req.path}`);
res.status(404).render("errors/404", { path: req.path });
}
}Dynamic Hot-Swapping
One of the most powerful features of Response Control is the ability to update it at runtime without restarting the server.
Maintenance Mode
Instantly point all unknown routes to a maintenance page during updates.
Security Lockdown
Dynamically switch 404s to 403s or honeypots if an attack is detected.
typescript
// Example: Emergency maintenance switch
app.setResponseControl({
enabled: true,
statusCode: 503,
content: "System is undergoing scheduled updates."
});Project Configuration
Master the xypriss.config.jsonc structure and dynamic variable injection.
