:thread: proxying HTTPS request
# help
p
🧵 proxying HTTPS request
I am running wiremock in a docker container with flag
Copy code
"--https-port", "9000"
I am also running a python flask app that has HTTPS_PROXY=https://0.0.0.0:9000 set in env
Wiremock has this stub configured
Copy code
{
  "request": {
    "scheme": "https",
    "url": "/other/thing",
    "method": "GET",
    "host": {
      "equalTo": "<http://example.com|example.com>"
    }
  },
  "scenarioName": "test",
  "response": {
    "status": 200,
    "jsonBody": {
      "body": "Hello, world!"
    },
    "headers": {
      "Content-Type": "application/json"
    }
  }
}
my expectation was that when I make API call to https://example.com/other/thing from my python flask app, the request will be intercepted by wiremock and return mock response
Copy code
{
  "body": "Hello, world!"
}
I have turned off the ssl verification in python
Copy code
response = requests.get(
      "<https://example.com/other/thing>", timeout=10, verify=False
    )
What instead happens is that the request fails with error in python app
Copy code
DEBUG:app:HTTPSConnectionPool(host='<http://example.com|example.com>', port=443): Max retries exceeded with url: /other/thing (Caused by SSLError(SSLError(1, '[SSL] record layer failure (_ssl.c:1006)')))
in wire mock I see error
Copy code
my_wiremock  | 2024-11-06 16:46:14.910 Opened Socket[addr=/172.18.0.1,port=40718,localport=9000]
my_wiremock  | 2024-11-06 16:46:14.916 Incoming bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.928 Outgoing bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.928 Outgoing bytes: 
my_wiremock  | 2024-11-06 16:46:14.929 Outgoing bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.930 Incoming bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.933 Outgoing bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.934 Outgoing bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.941 Incoming bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.942 Outgoing bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.942 Outgoing bytes omitted. Could not decode with charset: UTF-8
my_wiremock  | 2024-11-06 16:46:14.944 Closed Socket[unconnected]
this works fine for if I switch to http, but for https it is not working
@Lee Turner sorry for bothering you, do you see any issue with this setup?