Skip to content

Fix dev server rejecting non-localhost hosts when using FX_PROFILER_HOST#5889

Open
ojuschugh1 wants to merge 3 commits intofirefox-devtools:mainfrom
ojuschugh1:fix-dev-server-host-check
Open

Fix dev server rejecting non-localhost hosts when using FX_PROFILER_HOST#5889
ojuschugh1 wants to merge 3 commits intofirefox-devtools:mainfrom
ojuschugh1:fix-dev-server-host-check

Conversation

@ojuschugh1
Copy link

@ojuschugh1 ojuschugh1 commented Mar 8, 2026

This PR fixes #5865

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.42%. Comparing base (23fea36) to head (5cb9f6e).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5889   +/-   ##
=======================================
  Coverage   85.42%   85.42%           
=======================================
  Files         321      321           
  Lines       32073    32073           
  Branches     8821     8823    +2     
=======================================
  Hits        27398    27398           
  Misses       4244     4244           
  Partials      431      431           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@mstange mstange left a comment

Choose a reason for hiding this comment

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

Thanks! Some small comments but overall looks good.

@ojuschugh1 ojuschugh1 force-pushed the fix-dev-server-host-check branch from 5cb9f6e to 3128e0b Compare March 15, 2026 10:13
@fatadel fatadel self-requested a review March 16, 2026 10:36
@fatadel
Copy link
Contributor

fatadel commented Mar 16, 2026

Hey @ojuschugh1,

Thanks a lot for the PR! It looks overall good, however, going thru the "Steps to reproduce" of the original issue still leads to the same error for me. Could you please have another look?

@ojuschugh1
Copy link
Author

Hey @fatadel, good catch - the original fix only handled the proxy's own host check but missed that esbuild itself started validating the Host header since v0.25.0. When accessing via a LAN IP, the proxy was forwarding the original Host header (e.g. 192.168.1.100:4242) to esbuild, which rejected it with a 403.

I've pushed a fix that rewrites the Host header to match esbuild's bound address before proxying. Also added IPv6 wildcard support to isHostAllowed. Could you try again with the latest changes?

@ojuschugh1 ojuschugh1 requested a review from mstange March 22, 2026 16:04
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.

Exposing dev server on addresses other than localhost does not work anymore

3 participants