Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Ingramz
Copy link
Contributor

@Ingramz Ingramz commented Mar 19, 2025

Fixes #992

Reproduction:

import { createApp, createRouter, defineEventHandler, getRequestHost } from "h3";

export const app = createApp();

const router = createRouter();
app.use(router);

router.get(
  "/",
  defineEventHandler((event) => {
    return getRequestHost(event, { xForwardedHost: true });
  }),
);

curl -H "X-Forwarded-Host: proxy1.tld, proxy2.tld" http://localhost:3000 - Should return proxy1.tld

@Ingramz Ingramz requested a review from pi0 as a code owner March 19, 2025 12:17
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thnx!

@codecov
Copy link

codecov bot commented Mar 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.98%. Comparing base (a58d7c9) to head (95a7514).
Report is 251 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #993      +/-   ##
==========================================
+ Coverage   77.83%   83.98%   +6.14%     
==========================================
  Files          47       36      -11     
  Lines        4286     2666    -1620     
  Branches      611      688      +77     
==========================================
- Hits         3336     2239    -1097     
+ Misses        933      425     -508     
+ Partials       17        2      -15     

☔ 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.

@pi0 pi0 merged commit cb9fc47 into h3js:main Apr 16, 2025
5 checks passed
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.

getRequestHost returns comma separated list of hosts in some proxy setups

2 participants