Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send default Host header when a request is forwarded to another server #1782

Open
celsogbj opened this issue Jul 26, 2023 · 1 comment
Open

Comments

@celsogbj
Copy link

Some proxy servers use the Host http header to understand what traffic to serve. This is well documented on #431.

I would be nice if it could by made directly by mockserver on configuration, somethink like this:

mockserver.proxyRemotePort=443
mockserver.proxyRemoteHost=foo.com
mockserver.overhideHostHeader=true

setting overhideHostHeader to true would set the Host header with the value on proxyRemoteHost property.

Currently workaronud is the client set the Host header to mockserver that will pass it on. But this is not always feasible.

@tony42
Copy link

tony42 commented Oct 22, 2024

For the case someone comes across this request. You can achieve this effect with the current REST API:

PUT http://localhost:1080/mockserver/expectation
{
    "httpOverrideForwardedRequest": {
        "requestOverride": {
            "headers": {
                "Host": [
                    "foo.com"
                ]
            }
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants