Skip to content

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

Open
ojuschugh1 wants to merge 1 commit 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 1 commit 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.

Comment on lines +42 to +44
const allowedHosts = BASE_ALLOWED_HOSTS.includes(host)
? BASE_ALLOWED_HOSTS
: [...BASE_ALLOWED_HOSTS, host];
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's just always do [...BASE_ALLOWED_HOSTS, host], checking the same host twice is not a problem.

const BASE_ALLOWED_HOSTS = ['localhost', '.app.github.dev'];

function isHostAllowed(hostHeader) {
function isHostAllowed(hostHeader, host) {
Copy link
Contributor

Choose a reason for hiding this comment

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

host as an argument name is not very descriptive, maybe boundHost might be better? Or extraAllowedHost?


return allowedHosts.some((allowedHost) => {
if (allowedHost.startsWith('.')) {
// Wildcard pattern like '.app.github.dev'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep this comment? It seems useful

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

2 participants