mock-server / mockserver

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
http://mock-server.com
Apache License 2.0
4.52k stars 1.06k forks source link

HTTPs proxy doesn't seem to work #1876

Closed DavidHe1127 closed 1 month ago

DavidHe1127 commented 1 month ago

Setting expectation below to forward https request doesn't seem to work with the verification GET request returns 301 response code which seems it's forwarding request in HTTP. Any idea what I've done is wrong?

Set expectations

curl -vX PUT -H "Authorization:Bearer ${TOKEN}" -H "Content-Type: application/json" 'https:/my-server/mockserver/mockserver/expectation' \
-d '{
  "httpRequest": {
    "method": "GET",
    "path": "/proxy"
  },
  "httpOverrideForwardedRequest": {
    "httpRequest": {
      "method": "GET",
      "path": "/mock_server/HTTPS_TLS.html",
      "headers": {
        "Host": [
          "mock-server.com"
        ],
        "Authorization": [
          "Bearer ${TOKEN}"
        ]
      },
      "secure": true,
      "socketAddress": {
        "host": "mock-server.com",
        "port": 443,
        "scheme": "HTTPS"
      }
    }
  }
}'

Verification

curl -vX GET -H "Authorization:Bearer ${TOKEN}" 'https://my-server/mockserver/proxy' \

What i expect:

The mock-server html is returned.

Context

Mock-server docker image mockserver/mockserver:5.14.0

DavidHe1127 commented 1 month ago

Close this issue as the same code works on 5.15.0