Ollie Hub acts as an intelligent proxy that intercepts requests to your target URLs and executes your custom functions. Learn how this interception works, how functions are routed and executed, and how to optimize performance.

Core Concept: Request Interception

How Ollie Hub Works

1

Request Interception

Ollie Hub receives requests intended for your target URL and captures all request details

Original: https://api.yourapp.com/users/123
Hub URL:  https://hub.ollie.app/https://api.yourapp.com/users/123
2

Function Routing

Based on URL patterns and HTTP methods, Hub determines which function should handle the request

// Exact match: /api/users/profile
// Pattern match: /api/users/*
// Catch-all: /*
3

Code Execution

Your custom function executes with full access to request data and can modify the response

export const handler = async (event) => {
  // Your custom logic here
  return { statusCode: 200, body: 'Custom response' };
};
4

Response Enhancement

Optional Response Functions can further modify the output before returning to the user

URL Patterns and Routing

Ollie Hub uses a simple proxy pattern to intercept requests:

# Your original endpoint
https://api.myapp.com/users

# Through Ollie Hub
https://hub.ollie.app/https://api.myapp.com/users

Error Handling & Policies

Understanding how Ollie Hub handles function failures is crucial for building reliable applications. Each function can be configured with an error policy that determines what happens when execution fails.

Skip Policy

Behavior: Continue execution even if function fails Use Case: Non-critical functions (analytics, logging, enhancements) Impact: Request processing continues normally Status: Function marked as skipped

Throw Policy

Behavior: Stop execution and return error if function fails Use Case: Critical functions (authentication, validation, security)
Impact: Request fails with error response Status: Function marked as failed

Error Policy Best Practices:

  • Use throw for authentication, validation, and security functions
  • Use skip for analytics, logging, and enhancement functions
  • Consider the impact on user experience when choosing policies

When functions have different error policies, the Hub handles them intelligently:

const functions = [
  { 
    name: "Authentication",
    on_error: "throw", 
    priority: 0 
  },      // Must succeed
  { 
    name: "Analytics", 
    on_error: "skip", 
    priority: 1 
  },      // Optional
  { 
    name: "Transform", 
    on_error: "throw", 
    priority: 2 
  }       // Must succeed
];

Key Points:

  • Request Functions: Execute sequentially, failures can stop the chain
  • Response Functions: Execute in parallel, failures are handled independently
  • Mixed Policies: Each function’s policy is evaluated individually

Important: Functions with throw policy will prevent subsequent functions from executing. Always consider the order and error policies when designing your function chain.

Next Steps

Key Insight: Ollie Hub acts as an intelligent proxy that intercepts your requests and executes custom code seamlessly. Understanding this flow helps you build more efficient and reliable functions.