Invalid Proxy to HTTPS URL

42 views
Skip to first unread message

Tyler Thatcher

unread,
Jun 28, 2023, 1:30:23 PM6/28/23
to mountebank-discuss
Hey guys, 

I am new to mountebank and curious if I can get some clarity on what is happening. I have an app which then forwards all connections to mountebank via proxy:

"port": 8081,
"protocol": "http",
"name": "proxy",
"stubs": [
{
"responses": [
{
"proxy": {
"mode": "proxyOnce",
"cert": "SSLCERT",
"key": "SSLKEY",
"behaviors": [
{"decorate": "config => {\n config.logger.info('Something');\n }"}
]
}
}
]
}
]
}

The problem is that is fails when trying to proxy from the app to this external api. I am trying to print the request headers (as no responses work), just to make sure that my app isn't passing any weird headers, or not copying some, but everything I have tried has failed. Does anyone have a solution to something like this?

Rahul Verma

unread,
Oct 18, 2023, 1:55:38 AM10/18/23
to mountebank-discuss
I have recorded https API and it worked for me, Below configuration i used.
Cert and key is not required unless your imposter is https. Here imposter is http but the proxy api is https
{
   "port":9909,
   "protocol":"http",
  "name":"Pet",
   "recordRequests": true,
   "stubs":[
      {
         "responses":[
            {
               "proxy":{
                  "to":"https://petstore.swagger.io",
                  "mode":"proxyOnce",
                  "predicateGenerators":[
                     {
                        "matches":{
                         
                           "method":true,
                           "path":true,
                          "query":true,
                          "body": true
                        },
                        "caseSensitive":true
                     }
                  ]
               }
            }
         ]
      }
   ]
}

Reply all
Reply to author
Forward
0 new messages