Skip to content

middleware proxy pass origin Host header #2647

Open
@art-frela

Description

@art-frela

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

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

Expected behaviour

proxy replace request.Host to target.URL.Host

Actual behaviour

request.Host stay immutable

Steps to reproduce

  • http server which checks Host header (srv1)
  • http server with echo using middleware proxy (proxy) - target url to srv1, domain for proxy <> domain for srv1
  • run both srv1 and proxy
  • request to proxy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions