Apache Traffic Server (ATS) Documentation

repository·master·Indexed 23 days ago

https://github.com/apache/trafficserver

A high-performance caching proxy and building block for cloud services featuring a plugin architecture. Documentation covers building HTML/PDF docs, configuring OpenSSL engines, integrating ModSecurity WAF with OWASP CRS, developing external extensions via crits_ CMake functions, and utilizing internal libraries like Catch2 for unit testing and FastLZ for high-speed compression.

Tokens
395K
Snippets
958
Records
2.1K
Agent score
83%

What's inside Apache Traffic Server

  1. What is Apache Traffic Server?

    master
    Apache Traffic Server (ATS) is a high-performance web proxy cache designed to improve network efficiency and performance. It works by caching frequently-accessed information at the edge of the network, bringing content physically closer to end users to enable faster delivery and reduced bandwidth usage. It is primarily used by enterprises, Internet service providers (ISPs), backbone providers, and large intranets to maximize available bandwidth.
  2. Introduction to the Apache Traffic Server API (TSAPI)

    master

    The Apache Traffic Server API (TSAPI) allows developers to create C-based plugins to customize Traffic Server behavior. Plugins are compiled into shared libraries that Traffic Server loads at startup. These plugins function by registering callback functions for specific Traffic Server events. When an event occurs, Traffic Server invokes the registered callbacks.

    Common use cases for TSAPI plugins include:

    • HTTP Processing: Filtering, denylisting, authorization, or content transformation.
    • Protocol Support: Enabling proxy-caching for new protocols.
    • Data Transformation: Appending data to HTTP responses or converting image formats (e.g., JPEG to GIF).
    • Security: Implementing authorization checks or denylisting specific sites.
    • Monitoring: Gathering client information from headers for database logging.
    #include <ts/ts.h>
    #include <ts/remap.h>
  3. Overview of Apache Traffic Server configuration files

    master

    Apache Traffic Server (ATS) uses various configuration files to manage caching, routing, security, and logging. These files can be in traditional text formats (like .config) or the newer YAML format (.yaml).

    Core Configuration Categories

    • Caching & Storage:

      • cache.config: Defines how and for what durations objects are cached based on destinations, clients, or URLs.
      • storage.yaml: Configures storage devices, paths, and protocol-specific cache space usage.
      • hosting.config: Assigns cache volumes to specific origin servers or domains.
    • Routing & Mapping:

      • remap.config / remap.yaml: Defines rules for routing incoming requests.
      • strategies.yaml: Configures NextHop strategies (replaces the deprecated parent.config).
      • splitdns.config: Configures specific DNS servers for specific conditions.
      • sni.yaml: Configures SNI-based Layer 4 routing.
    • Security & Access Control:

      • ip_allow.yaml: Controls cache access based on source IP addresses/networks and can limit specific HTTP methods.
      • ssl_multicert.yaml: Manages multiple SSL certificates for termination based on addresses or SNI.
    • Plugins & Extensions:

      • plugin.config: Controls runtime loadable plugins and their configurations.
      • plugin.yaml: A YAML alternative to plugin.config that supports disabling plugins, explicit load ordering, and inline configuration.
    • System & Observability:

      • records.yaml: Contains general configuration variables affecting overall ATS operation.
      • logging.yaml: Defines custom log formats, filters, and processing options.
      • jsonrpc.yaml: Configures arguments for the JSON-RPC endpoint.
  4. Overview of Apache Traffic Server developer resources

    master

    The Apache Traffic Server developer documentation is organized into several functional areas to help you build extensions:

    • API Reference: Comprehensive documentation of C API functions and types.
    • Hooks and Transactions: Functions to hook your plugin into HTTP processes.
    • IO Interfaces: Documentation for TSVConnection, TSVIO, TSIOBuffer, TSNetVConnection, and the Cache API.
    • Continuations: The callback mechanism and data abstractions used throughout TS.
    • Management & Configuration: Setting up configuration interfaces, accessing plugin files, and managing plugin licensing.
    • Statistics: Functions to add custom statistics to your plugin.
  5. What is the txn_box plugin?

    master

    The txn_box (Transaction Box) is an experimental transaction tool box plugin for Apache Traffic Server. It is designed to serve as a unified, single plugin to replace multiple inconsistent plugins, including:

    • header_rewrite
    • regex_remap
    • ssl_headers
    • cookie_remap
    • cache_key
    • conf_remap

    Additionally, it acts as a test bed for restructuring Traffic Server remapping to utilize YAML and drives the development of the libswoc++ library.

  6. Overview of FastLZ compression

    master

    FastLZ is an ANSI C/C90 implementation of the Lempel-Ziv 77 (LZ77) lossless data compression algorithm. It is optimized for high-speed compression and decompression at the expense of a lower compression ratio compared to algorithms like zlib.

    Best Use Cases:

    • Series of text or paragraphs.
    • Sequences of raw pixel data.
    • Any blocks of data containing significant repetition.

    Avoid Using For:

    • Formats that are already optimally compressed, such as images or videos.
  7. Overview of the Access Control Plugin

    master

    The access_control plugin provides mechanisms for controlling access to objects stored in the CDN cache. It is designed to handle common CDN use cases such as:

    • Cache Access Control: Ensuring cached objects are served only to authenticated and authorized users.
    • Authorizing Multiple Requests: Allowing a User Agent (UA) to be authenticated/authorized only once within a defined time period.
    • Multiple Page Versions: Serving different content for the same URI based on a target audience (e.g., different roles or user groups).
    • Proxy Only Mode: In the event of an access control failure at the Edge, the request is forwarded to the origin rather than redirecting the user to external services.

    Key Design Principles:

    • Access Approval vs. Authentication: The plugin focuses on access approval (granting or rejecting access based on a token) rather than performing the actual authentication/authorization. The Origin/Application is responsible for the authentication and authorization flow using services like IdMS or Directory Services.
    • Self-Contained Tokens: Access tokens should be compact and self-contained, allowing them to be extracted from HTTP headers, cookies, or URI query parameters.
    • Cache Key Integration: To support multiple versions of the same object for different audiences, the plugin relies on extracting a subject from the token and adding it to the cache key (typically via the cachekey plugin).
  8. Navigate Apache Traffic Server documentation

    master

    The Apache Traffic Server documentation is organized into three primary sections to support different user roles:

    1. Introduction and Getting Started: Covers the preface, initial setup/getting started guides, and release notes.
    2. Administrator's Guide: Focuses on operational tasks including installation, configuration, security, storage, monitoring, logging, and layer-4 routing. It also contains detailed information on available plugins.
    3. Developer's Guide: Aimed at contributors and engineers, covering core architecture, internal libraries, plugin development, API usage, debugging, testing, and the release process.

    Note: This specific file (doc/index-latex.rst) is used for generating the LaTeX/PDF version of the documentation. For HTML-based documentation, refer to index.rst.

  9. Use traffic_ctl to manage Apache Traffic Server

    master

    The traffic_ctl command-line utility is used to display, manipulate, and configure a running instance of Apache Traffic Server. It communicates with the server using the JSONRPC 2.0 protocol.

    Key subcommands include:

    • config: Manipulate and display configuration records.
    • metric: Manipulate performance and status metrics.
    • server: Examine the server status.
    • storage: Manipulate cache storage.
    • plugin: Interact with plugins.
    • host: Manipulate host status.
    • hostdb: Manipulate HostDB status.
    • rpc: Interact directly with the JSONRPC server in Traffic Server.
  10. Use traffic_cache_tool for cache inspection and modification

    master

    traffic_cache_tool is a command-line utility used to interact with the Apache Traffic Server cache for both inspection and modification. It uses a nested command structure.

    Important Safety Note: By default, the tool operates in a "dry run" mode where all storage is opened read-only. To perform any operation that modifies storage (such as clear, alloc, or init), you must include the --write flag.