.. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. .. include:: ../../common.defs .. _admin-plugins-stale_response: Stale Response Plugin ********************* This plugin adds ``stale-while-relavidate`` and ``stale-if-error`` ``Cache-Control`` directive functionality. The ``stale-while-revalidate`` directive specifies a number of seconds that an item can be stale and used as a cached response while |TS| revalidates the cached item. The ``stale-if-error`` directive specifies how stale a cached response can be and still be used as a response if the origin server replies with a 500, 502, 503, or 504 HTTP status. The plugin currently only supports the ``stale-if-error`` directive in responses. For more details, see `RFC 5861 `_ for the specification of these directives. Building and Installation ========================= The Stale Response plugin is an experimental plugin. To build it, pass ``-DBUILD_EXPERIMENTAL_PLUGINS=ON`` to the ``cmake`` command when building |TS|. By default, that will build the ``stale_response.so`` plugin and install it in the ``libexec/trafficserver`` directory. Configuration ============= The Stale Response plugin supports being used as either a global plugin or as a remap plugin. To configure |TS| to use the Stale Response plugin, simply add it to either the :file:`plugin.config` to configure it as a global plugin and restart traffic-server or add it to the desired remap lines in the :file:`remap.config` and reload |TS|. The following configurations are available for the plugin: Default values can be specified for responses that do not contain the directives: * ``--stale-while-revalidate-default