Skip to content

Update trusted_proxies to match docker.address range #4014

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

Closed
wants to merge 1 commit into from

Conversation

eRaid6
Copy link

@eRaid6 eRaid6 commented May 8, 2025

Updating DOCS.md to reflect that HA/Supervisor uses 172.30.32.0/23 network for docker so trusted_proxies should match or it's possible for connections to fail with a error of Connection refused) while connecting to upstream.

~# ha net info
docker:
  address: 172.30.32.0/23
  dns: 172.30.32.3
  gateway: 172.30.32.1
  interface: hassio

See https://community.home-assistant.io/t/nginx-configuration-connection-refused/62407 and https://github.com/home-assistant/supervisor/blob/7c6c982414794172298b2f29ce2358df062b1c0a/supervisor/const.py#L35 for additional info.

Summary by CodeRabbit

  • Documentation
    • Updated the example configuration to expand the trusted proxy IP range, now covering both 172.30.32.0/24 and 172.30.33.0/24 subnets.

Updating `DOCS.md` to reflect that HA/Supervisor uses `172.30.32.0/23` network for docker so `trusted_proxies` should match or it's possible for connections to fail with a error of `Connection refused) while connecting to upstream`.
```
~# ha net info
docker:
  address: 172.30.32.0/23
  dns: 172.30.32.3
  gateway: 172.30.32.1
  interface: hassio
```
See https://community.home-assistant.io/t/nginx-configuration-connection-refused/62407 and https://github.com/home-assistant/supervisor/blob/7c6c982414794172298b2f29ce2358df062b1c0a/supervisor/const.py#L35 for additional info.
Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @eRaid6

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link

home-assistant bot commented May 8, 2025

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft May 8, 2025 12:27
@eRaid6 eRaid6 marked this pull request as ready for review May 8, 2025 12:29
@home-assistant home-assistant bot dismissed their stale review May 8, 2025 12:29

Stale

Copy link
Contributor

coderabbitai bot commented May 8, 2025

📝 Walkthrough

Walkthrough

The documentation for the NGINX Proxy add-on was updated to expand the example trusted_proxies IP range in the Home Assistant configuration from 172.30.33.0/24 to 172.30.32.0/23, thereby including a wider range of trusted proxy addresses.

Changes

File(s) Change Summary
nginx_proxy/DOCS.md Updated example trusted_proxies configuration to use a broader subnet (172.30.32.0/23).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomeAssistantConfig
    participant NGINXProxy

    User -> HomeAssistantConfig: Edits configuration.yaml
    HomeAssistantConfig -> NGINXProxy: Sets trusted_proxies: 172.30.32.0/23
    NGINXProxy -> HomeAssistantConfig: Accepts requests from expanded IP range
Loading

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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: 0

🧹 Nitpick comments (2)
nginx_proxy/DOCS.md (2)

9-9: Use bold for UI strings instead of quotes.

Replace the quoted UI string "INSTALL" with bold formatting:

- 3. Click on the "INSTALL" button.
+ 3. Click on the **INSTALL** button.

7-8: Front the goal in step-by-step instructions.

Lead with the action goal before the location. For example:

- 1. Navigate in your Home Assistant frontend to **Settings** -> **Add-ons** -> **Add-on store**.
+ 1. Open the add-on store in the Home Assistant frontend: **Settings** > **Add-ons**.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 302a2bf and 080d682.

📒 Files selected for processing (1)
  • nginx_proxy/DOCS.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
`*/**(html|markdown|md)`: - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure t...

*/**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'
  • nginx_proxy/DOCS.md
`*/**(html|markdown|md)`: - Use bold to mark UI strings. - If "" are used to mark UI strings, replace them by bold.

*/**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.
  • nginx_proxy/DOCS.md
`*/**(html|markdown|md)`: - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"

*/**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"

  • nginx_proxy/DOCS.md
`*/**(html|markdown|md)`: - Use sentence-style capitalization also in headings.

*/**(html|markdown|md): - Use sentence-style capitalization also in headings.

  • nginx_proxy/DOCS.md
`*/**(html|markdown|md)`: do not comment on HTML used for icons

*/**(html|markdown|md): do not comment on HTML used for icons

  • nginx_proxy/DOCS.md
`*/**(html|markdown|md)`: Avoid flagging inline HTML for embedding videos in future reviews for this repository.

*/**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

  • nginx_proxy/DOCS.md
🔇 Additional comments (1)
nginx_proxy/DOCS.md (1)

21-23: Trusted proxies range updated to encompass Docker network.

Changing trusted_proxies from a single /24 to 172.30.32.0/23 correctly covers both 172.30.32.0/24 and 172.30.33.0/24, matching the Supervisor Docker address.

@agners
Copy link
Member

agners commented May 9, 2025

Updating DOCS.md to reflect that HA/Supervisor uses 172.30.32.0/23 network for docker so trusted_proxies should match or it's possible for connections to fail with a error of Connection refused) while connecting to upstream.

Well, the proxy runs as an add-on, and gets an IP from the IP assignment pool, which is DOCKER_NETWORK_RANGE. So your Proxy should always get an IP from the 172.30.33.0/24 range.

That said, widen the range doesn't hurt. But it really should not be necessary.

Did you actually encounter that issue? What IP did the NGINX proxy add-on have at that time?

@agners agners marked this pull request as draft May 9, 2025 09:24
@agners
Copy link
Member

agners commented May 12, 2025

Uh, could it be that your clients connect through IPv6? In that case it seems that the proxy sees the hassio host IP 172.30.32.1 (see also this discussion).

However, defining 172.30.32.1 as trusted proxy IP is not the right solution here, as this would mean all IPv6 addresses are considered trusted. We need to have a NGINX proxy which can make proper IPv6 sockets such that the source IP is correctly mapped to the connecting IPv6 address.

@github-actions github-actions bot added the stale label Jul 11, 2025
@github-actions github-actions bot closed this Jul 18, 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.

2 participants