Skip to content

fix(ReverseProxy): handle forwarding#510

Open
Betree wants to merge 1 commit into
stagingfrom
fix/reverse-proxy-forward
Open

fix(ReverseProxy): handle forwarding#510
Betree wants to merge 1 commit into
stagingfrom
fix/reverse-proxy-forward

Conversation

@Betree
Copy link
Copy Markdown
Member

@Betree Betree commented Apr 30, 2026

No description provided.

@Betree Betree self-assigned this Apr 30, 2026
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider turning service_subdomain_regex/0 into a module attribute (e.g. @service_subdomain_regex) to avoid recompiling the same regex on every call to routing_host/1 and get_domain_from_host/1.
  • In routing_host/1, you currently prefer conn.host whenever it matches the service subdomain regex; if an internal host ever accidentally matches that pattern (e.g. rest.internal.local), x-forwarded-host will be ignored—consider tightening the condition or explicitly preferring a valid x-forwarded-host when present and different from conn.host.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider turning `service_subdomain_regex/0` into a module attribute (e.g. `@service_subdomain_regex`) to avoid recompiling the same regex on every call to `routing_host/1` and `get_domain_from_host/1`.
- In `routing_host/1`, you currently prefer `conn.host` whenever it matches the service subdomain regex; if an internal host ever accidentally matches that pattern (e.g. `rest.internal.local`), `x-forwarded-host` will be ignored—consider tightening the condition or explicitly preferring a valid `x-forwarded-host` when present and different from `conn.host`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Betree Betree force-pushed the fix/reverse-proxy-forward branch from 2575f1b to 347d04c Compare May 1, 2026 09:02
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