labstack / echo

High performance, minimalist Go web framework
https://echo.labstack.com
MIT License
29.01k stars 2.21k forks source link

middleware proxy pass origin Host header #2647

Open art-frela opened 3 weeks ago

art-frela commented 3 weeks ago

Issue Description

Requests that reach the final server contain the Host header from the original request. If the destination server checks the header Host (eg: ingress in k8s cluster with Host rules) and if the values ​​do not match, then the request is rejected or etc...

Checklist

Expected behaviour

proxy replace request.Host to target.URL.Host

Actual behaviour

request.Host stay immutable

Steps to reproduce

client (localhost) --(Host: proxy.domain.com)--> proxy (proxy.domain.com) --(Host: proxy.domain.com)--> srv1 (srv1.domain.com)

Version/commit

echo v4.12.0

dirty workaround

req.Host = tgt.URL.Host

P.S. Maybe add option to ProxyConfig