Skip to content

[Channel] Resolve localhost equivalents when matching channel by hostname#18726

Merged
GSadee merged 1 commit intoSylius:2.2from
Rafikooo:feature/localhost-hostname-normalization
Jan 19, 2026
Merged

[Channel] Resolve localhost equivalents when matching channel by hostname#18726
GSadee merged 1 commit intoSylius:2.2from
Rafikooo:feature/localhost-hostname-normalization

Conversation

@Rafikooo
Copy link
Copy Markdown
Contributor

When resolving channels by hostname, localhost, 127.0.0.1 and ::1 are now treated as equivalents. If no channel is found for the exact hostname but the hostname is one of these localhost variants, the resolver will try the other variants.

Previously, Sylius did exact string comparison when matching channels by hostname. This meant that a channel configured with localhost would not be matched when accessing via 127.0.0.1, and vice versa. This caused friction in local development when browser URL and fixtures used different hostname formats.

The fix adds fallback logic in HostnameBasedRequestResolver that checks other localhost equivalents when:

  1. No channel is found for the exact hostname
  2. The hostname is one of the localhost equivalents (localhost, 127.0.0.1, ::1)

…name

When resolving channels by hostname, localhost, 127.0.0.1 and ::1 are now treated as equivalents. If no channel is found for the exact hostname but the hostname is one of these localhost variants, the resolver will try the other variants.

This improves local development experience when browser URL and fixtures use different formats (e.g. localhost in fixtures but 127.0.0.1 in browser).
@Rafikooo Rafikooo requested review from a team as code owners January 15, 2026 12:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 15, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 15, 2026

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

@GSadee GSadee added the DX Issues and PRs aimed at improving Developer eXperience. label Jan 19, 2026
@GSadee GSadee merged commit 425eac2 into Sylius:2.2 Jan 19, 2026
65 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DX Issues and PRs aimed at improving Developer eXperience.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants