Skip to content

feat: Adding PROXY_CACHE_USE_STALE env variable #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mhbahmani
Copy link

Proposed changes

Making proxy_cache_use_stale configurable using the PROXY_CACHE_USE_STALE environment variable.

Feature request issue: #437

MohammadHosein Bahmani added 4 commits August 13, 2025 17:07
default value for this variable is 'error timeout http_500 http_502 http_503 http_504'.
…able

default value for this env variable is 'error timeout http_500 http_502 http_503 http_504'.
users can set their desired value for PROXY_CACHE_USE_STALE and configure their s3 gateway.
@Copilot Copilot AI review requested due to automatic review settings August 13, 2025 14:04
@mhbahmani mhbahmani requested a review from a team as a code owner August 13, 2025 14:04
Copy link

🎉 Thank you for your contribution! It appears you have not yet signed the F5 Contributor License Agreement (CLA), which is required for your changes to be incorporated into an F5 Open Source Software (OSS) project. Please kindly read the F5 CLA and reply on a new comment with the following text to agree:


I have hereby read the F5 CLA and agree to its terms


MohammadHosein Bahmani seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds configurable support for the nginx proxy_cache_use_stale directive through a new PROXY_CACHE_USE_STALE environment variable. This allows users to customize when stale cached data can be served instead of being hardcoded to specific error conditions.

  • Introduces PROXY_CACHE_USE_STALE environment variable with default value covering common error scenarios
  • Updates nginx configuration template to use the new environment variable
  • Adds documentation and example configurations across all deployment methods

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
common/etc/nginx/templates/default.conf.template Replaces hardcoded proxy_cache_use_stale with environment variable
common/etc/nginx/nginx.conf Adds PROXY_CACHE_USE_STALE to available environment variables
Dockerfile.* Sets default environment variable value in all Docker configurations
docs/getting_started.md Documents the new configuration option
settings.example Adds example configuration value
test/docker-compose.yaml Includes variable in test configuration
standalone_ubuntu_oss_install.sh Adds logging for the new configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

| `S3_SERVER_PROTO` | Yes | `http`, `https` | | Protocol to used connect to S3 server |
| `S3_SERVER` | Yes | | | S3 host to connect to |
| Name | Required? | Allowed Values | Default | Description |
| ------------------------------------- | --------- |--------------------------------------------| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
Copy link
Preview

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table formatting appears to have inconsistent spacing in the separator line. The third column separator should have consistent dashes like the others.

Suggested change
| ------------------------------------- | --------- |--------------------------------------------| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ------------------------------------- | --------- | ----------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

Copilot uses AI. Check for mistakes.

| `PROXY_CACHE_VALID_OK` | No | | `1h` | Sets caching time for response code 200 and 302 |
| `PROXY_CACHE_VALID_NOTFOUND` | No | | `1m` | Sets caching time for response code 404 |
| `PROXY_CACHE_VALID_FORBIDDEN` | No | | `30s` | Sets caching time for response code 403 |
| `PROXY_CACHE_USE_STALE` | No | | `error timeout http_500 http_502 http_503 http_504` | Sets conditions under which stale cached data can be used. |
Copy link
Preview

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation should specify the allowed values for PROXY_CACHE_USE_STALE. Consider adding valid nginx proxy_cache_use_stale parameters like 'error', 'timeout', 'invalid_header', 'updating', 'http_XXX' codes, etc. to the 'Allowed Values' column.

Suggested change
| `PROXY_CACHE_USE_STALE` | No | | `error timeout http_500 http_502 http_503 http_504` | Sets conditions under which stale cached data can be used. |
| `PROXY_CACHE_USE_STALE` | No | `error`, `timeout`, `invalid_header`, `updating`, `http_500`, `http_502`, `http_503`, `http_504`, `http_XXX` | `error timeout http_500 http_502 http_503 http_504` | Sets conditions under which stale cached data can be used. |

Copilot uses AI. Check for mistakes.

@mhbahmani mhbahmani changed the title Adding PROXY_CACHE_USE_STALE env variable feat: Adding PROXY_CACHE_USE_STALE env variable Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant