Skip to content

docs: add reverse proxy guide for HTTP/2 support#3779

Closed
sanki92 wants to merge 3 commits into
gofiber:mainfrom
sanki92:docs/reverse-proxy-guide
Closed

docs: add reverse proxy guide for HTTP/2 support#3779
sanki92 wants to merge 3 commits into
gofiber:mainfrom
sanki92:docs/reverse-proxy-guide

Conversation

@sanki92
Copy link
Copy Markdown

@sanki92 sanki92 commented Oct 3, 2025

Description

This PR adds comprehensive reverse proxy documentation to help users enable HTTP/2 support for Fiber applications. The SendEarlyHints feature and other HTTP/2-dependent functionality require proper proxy configuration, which was previously undocumented.

Fixes #3735

Changes introduced

  • Documentation Update: Updated SendEarlyHints section in docs/api/ctx.md to reference the new proxy guide
  • Documentation Update: Added new reverse proxy guide at docs/guide/reverse-proxy.md with configuration examples for Nginx, Traefik, and Caddy
  • Examples: Provided production-ready configuration examples for all major reverse proxies
  • Migration Guide: Included Fiber application configuration steps for proxy environments
  • Benchmarks: Not applicable for documentation changes
  • Changelog/What's New: Documentation enhancement for HTTP/2 support
  • API Alignment with Express: Not applicable for documentation changes
  • API Longevity: Not applicable for documentation changes

Type of change

  • Documentation update (changes to documentation)

Checklist

  • Conducted a self-review of the code and provided comments for complex or critical parts.
  • Updated the documentation in the /docs/ directory for Fiber's documentation.
  • Ensured that new and existing unit tests pass locally with the changes.
  • Verified that any new dependencies are essential and have been agreed upon by the maintainers/community.
  • Added or updated unit tests to validate the effectiveness of the changes or new features. (Not applicable for documentation)
  • Followed the inspiration of the Express.js framework for new functionalities, making them similar in usage. (Not applicable for documentation)
  • Aimed for optimal performance with minimal allocations in the new code. (Not applicable for documentation)
  • Provided benchmarks for the new code to analyze and improve upon. (Not applicable for documentation)

- Add comprehensive reverse proxy configuration guide
- Include examples for Nginx, Traefik, and Caddy
- Update SendEarlyHints documentation with proxy reference
- Provide production-ready configurations with security considerations

Fixes #3735
@sanki92 sanki92 requested a review from a team as a code owner October 3, 2025 18:25
@welcome
Copy link
Copy Markdown

welcome Bot commented Oct 3, 2025

Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 3, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Updated SendEarlyHints docs to require HTTP/2+ and point to a new Reverse Proxy Configuration guide. Added a new guide documenting how to enable HTTP/2/HTTP/3 via common reverse proxies and how to configure Fiber behind a proxy. No public API changes.

Changes

Cohort / File(s) Summary
API docs: SendEarlyHints note update
docs/api/ctx.md
Reworded the SendEarlyHints protocol requirement to state HTTP/2 or newer is required; clarified that legacy HTTP/1.1 clients may ignore or misbehave; added a pointer to the new Reverse Proxy Configuration guide.
New guide: Reverse proxy configuration
docs/guide/reverse-proxy.md
Added a guide covering enabling HTTP/2/HTTP/3 via reverse proxies (Nginx, Traefik, Caddy) with example configs, Fiber proxy-related settings (trusted proxies, SendEarlyHints), a Go example, testing steps, performance and security notes, and references.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Browser as Browser (HTTP/2+)
    participant Proxy as Reverse Proxy (Nginx/Traefik/Caddy)
    participant App as Fiber App (HTTP/1.1)

    rect rgb(220,245,220)
    Note over Browser,Proxy: Client⇄Proxy uses HTTP/2 or HTTP/3
    Browser->>Proxy: Request (HTTP/2)
    Proxy->>App: Forward request (may be HTTP/1.1)
    end

    rect rgb(245,235,220)
    Note over App,Proxy: App may send 103 Early Hints
    App->>Proxy: 103 Early Hints (HTTP/1.1)
    Proxy->>Browser: Upgrade/translate to HTTP/2 103 if supported
    end

    rect rgb(235,240,255)
    Note over Proxy,Browser: Browser receives Early Hints and starts preloads
    Proxy->>Browser: 103 Early Hints (HTTP/2)
    Browser->>Proxy: Requests for preloaded assets
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

v3

Suggested reviewers

  • gaby
  • sixcolors
  • ReneWerner87
  • efectn

Poem

I twitch my nose at headers bright,
Through proxy tunnels, day and night.
Nginx hums and Caddy sings,
Early hints on nimble wings. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the primary change by indicating the addition of a reverse proxy guide for HTTP/2 support in the documentation. It clearly reflects the scope and content of the pull request without extraneous detail. The phrasing is concise, specific, and aligned with repository conventions.
Linked Issues Check ✅ Passed The documentation changes satisfy each objective from issue #3735 by updating the SendEarlyHints documentation to reference HTTP/2 requirements, adding a dedicated reverse proxy guide with actionable instructions, and including configuration examples for Nginx, Traefik, and Caddy. The new guide clearly explains how to configure reverse proxies to enable HTTP/2 (and HTTP/3) so that Early Hints responses are properly delivered. This fully meets the requirements outlined in the linked issue.
Out of Scope Changes Check ✅ Passed All changes in this pull request are confined to documentation files under the /docs/ directory and directly relate to the objectives of issue #3735. There are no modifications to code, tests, or unrelated documentation that would indicate out-of-scope work. The scope aligns precisely with the intended documentation enhancement for HTTP/2 support.
Description Check ✅ Passed The pull request description follows the repository template by including a description of the changes, a link to the fixed issue, a detailed list of introduced changes, the type of change, and a checklist. While most sections are complete and clearly structured, it omits the commit formatting guidelines specified in the template and retains some non-applicable checklist items. Overall, the description is thorough and provides sufficient context for reviewers.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1451e7d and 0764f4c.

📒 Files selected for processing (2)
  • docs/api/ctx.md (1 hunks)
  • docs/guide/reverse-proxy.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/guide/reverse-proxy.md
  • docs/api/ctx.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @sanki92, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces essential documentation to guide users on enabling HTTP/2 and HTTP/3 support for their Fiber applications through reverse proxy configurations. It addresses the previously undocumented requirement for features like SendEarlyHints by providing detailed setup instructions for popular proxies such as Nginx, Traefik, and Caddy, alongside necessary Fiber application adjustments. The goal is to ensure users can leverage modern web protocols effectively and securely with Fiber.

Highlights

  • New Reverse Proxy Guide: A new comprehensive guide docs/guide/reverse-proxy.md has been added, detailing how to configure reverse proxies (Nginx, Traefik, Caddy) for Fiber applications to enable HTTP/2 and HTTP/3 support.
  • SendEarlyHints Documentation Update: The SendEarlyHints section in docs/api/ctx.md has been updated to include a direct reference to the new reverse proxy guide, clarifying its dependency on HTTP/2.
  • Production-Ready Examples: The new guide includes production-ready configuration examples for Nginx, Traefik, and Caddy, making it easier for users to implement modern protocol support.
  • Fiber Configuration for Proxies: Steps for configuring Fiber applications to properly handle proxy headers and trust proxy environments are now documented, including an example code snippet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

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 comprehensive reverse proxy documentation to help users enable HTTP/2 support for Fiber applications, specifically targeting features like SendEarlyHints that require modern protocols.

  • Added a new reverse proxy configuration guide with examples for Nginx, Traefik, and Caddy
  • Updated the SendEarlyHints documentation to reference the new proxy guide
  • Provided production-ready configuration examples and Fiber application setup instructions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
docs/guide/reverse-proxy.md New comprehensive guide covering reverse proxy setup for HTTP/2 support with configuration examples for major proxies
docs/api/ctx.md Updated SendEarlyHints documentation to reference the new reverse proxy guide

Comment thread docs/api/ctx.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3c54bb and b535174.

📒 Files selected for processing (2)
  • docs/api/ctx.md (1 hunks)
  • docs/guide/reverse-proxy.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs/**

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Review and update the contents of the docs folder if necessary when modifying code

Files:

  • docs/api/ctx.md
  • docs/guide/reverse-proxy.md

Comment thread docs/guide/reverse-proxy.md Outdated
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a comprehensive and much-needed guide for configuring reverse proxies with Fiber to enable HTTP/2. The documentation is well-structured and covers popular proxies like Nginx, Traefik, and Caddy. I've provided some suggestions to improve the accuracy and security of the configuration examples, including updating Nginx's SSL settings, clarifying security implications, removing redundant configurations for Traefik and Caddy, and fixing a critical error in the Fiber application configuration example.

Comment thread docs/guide/reverse-proxy.md
Comment thread docs/guide/reverse-proxy.md Outdated
Comment thread docs/guide/reverse-proxy.md Outdated
Comment thread docs/guide/reverse-proxy.md Outdated
Comment thread docs/guide/reverse-proxy.md Outdated
Comment thread docs/guide/reverse-proxy.md Outdated
Remove duplicate mention of HTTP/2 requirement and improve clarity
as suggested in code review.
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread docs/api/ctx.md Outdated
- Fix Fiber v3 configuration with correct TrustProxy settings
- Remove ssl_early_data directive for security
- Update SSL cipher configuration with modern standards
- Add security warning for Traefik dashboard exposure
- Remove redundant proxy headers from Traefik and Caddy configs
- Improve SendEarlyHints documentation clarity
@sanki92 sanki92 requested a review from Copilot October 3, 2025 18:45
Copy link
Copy Markdown
Contributor

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

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

Comment thread docs/guide/reverse-proxy.md
Comment thread docs/guide/reverse-proxy.md
@gaby
Copy link
Copy Markdown
Member

gaby commented Oct 3, 2025

@sanki92 Thanks, but we already have a PR for that issue.

Duplicate of #3778

@gaby gaby closed this Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🧹 [Maintenance]: Document reverse proxy workaround for SendEarlyHints

3 participants