Problems with html pages using httpForward #271

xenaCode opened this Issue Aug 3, 2016 · 2 comments


None yet

3 participants

xenaCode commented Aug 3, 2016

Hi James,
I'm not sure if writing an issue is the right approach for asking this question.
I have the next configuration:

mockServerClient("localhost", 8888).mockAnyResponse(
        'httpRequest': {
            'method': 'GET',
        "httpForward": {
            "host": "",
            "port": 8887,
            "scheme": "HTTP"
        'times': {
            'unlimited': true

Then I run server:
java -jar mockserver-netty-3.10.4-jar-with-dependencies.jar -serverPort 8888
and run SimpleHTTPServer on port 8887.
It works good but when requested html pages, MockServer added Content-Type: text/plain, although in response its value is text/html.
In Wireshark I got:

Src port: 8887
Status Code: 200
Response Phrase: OK
Content-Type: text/html 

Src port: 8888
Status Code: 200
Response Phrase: OK
Content-Type: text/html 
Content-Type: text/plain 

And it's displayed as plain text and not as html. It's obviously that MockServer added the second Content-Type to response. But why it's happend?
I tried to change configuration in different way, but it's still not working.

Hope I am able to explain the scenario that I am struggling with. Any help would be really appreciated.

Thanks a lot,


I faced exactly the same problem today, but in my case, it adds Content-Type: text/plain if it's not set, which changes the logic of processing in downstream application


I believe this should now be resolved, but as I couldn't manage to reduce the duplicate Content-Type header issue I can't be sure its 100% fixed. This fix will be in a new release in the next week or so.

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