mockserver icon indicating copy to clipboard operation
mockserver copied to clipboard

Invalid "content-encoding" value ".*" is automatically added to the request header

Open ouchxp opened this issue 2 years ago • 2 comments

Describe the issue When I send a POST request to the mock server, it proxy the request to my other service with an extra request header content-encoding: .* the target service fails because .* is not a valid encoding.

What you are trying to do Simply proxy a request to target service

MockServer version 5.14.0

To Reproduce Steps to reproduce the issue:

  1. How you are running MockServer (i.e maven plugin, docker, etc) docker with configs below
    environment:
      MOCKSERVER_LOG_LEVEL: DEBUG
      MOCKSERVER_SERVER_PORT: 1080
      PROXY_REMOTE_HOST: order
      PROXY_REMOTE_PORT: 3000
  1. Code you used to create expectations curl -v 'http://localhost:1080/orders' -X POST --data '{}'
  2. What error you saw Invalid content-encoding value added to the request header, target service fails

Expected behaviour Proxy requests should be exactly the same as the original requests

MockServer Log

order-service-mock                 | 2022-09-06 05:33:59 5.14.0 INFO 1080 received request:
order-service-mock                 |
order-service-mock                 |   {
order-service-mock                 |     "method" : "POST",
order-service-mock                 |     "path" : "/orders",
order-service-mock                 |     "headers" : {
order-service-mock                 |       "content-length" : [ "2" ],
order-service-mock                 |       "content-encoding" : [ ".*" ],
order-service-mock                 |       "User-Agent" : [ "curl/7.79.1" ],
order-service-mock                 |       "Host" : [ "localhost:1080" ],
order-service-mock                 |       "Content-Type" : [ "application/x-www-form-urlencoded" ],
order-service-mock                 |       "Accept" : [ "*/*" ]
order-service-mock                 |     },
order-service-mock                 |     "keepAlive" : true,
order-service-mock                 |     "secure" : false,
order-service-mock                 |     "localAddress" : "985a7e517c42/192.168.224.12:1080",
order-service-mock                 |     "remoteAddress" : "192.168.224.1",
order-service-mock                 |     "body" : "{}"
order-service-mock                 |   }

ouchxp avatar Sep 06 '22 05:09 ouchxp

Yes I am having this exact same issue.

My proxied POST calls return :

"faultstring": "Unsupported Encoding \".*\"",

the only work around is to add :

Content-Encoding: "" to the headers which seems to overwrite the bad value.

obviously this is not a workable solution for testing clients.

Please fix

Agembin1 avatar Jun 01 '23 21:06 Agembin1

This seems to be fixed in 5.15.0 - I checked the Changelog - and for me the header is no longer there

ThaDaVos avatar Jul 21 '23 13:07 ThaDaVos