restaumatic / vcr-proxy

Proxy for request, response recording and playback
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

does it work with subdomains? #10

Open timini opened 2 years ago

timini commented 2 years ago
http://gdi.localhost:8080/

gives following error

No host could be extracted from the endpoint
CallStack (from HasCallStack):
  error, called at src/Network/VCR/Middleware.hs:165:19 in vcr-proxy-0.1.0.0-AvOZqlZQm134DbIokw6g4B:Network.VCR.Middleware
timini commented 2 years ago

i added http:// and fixed the upstream, now getting different error

HttpExceptionRequest Request {
  host                 = "proxy"
  port                 = 80
  secure               = False
  requestHeaders       = [("Host","proxy"),("Connection","keep-alive"),("Cache-Control","max-age=0"),("sec-ch-ua","\"Chromium\";v=\"104\", \" Not A;Brand\";v=\"99\", \"Google Chrome\";v=\"104\""),("sec-ch-ua-mobile","?0"),("sec-ch-ua-platform","\"Windows\""),("Upgrade-Insecure-Requests","1"),("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"),("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"),("Sec-Fetch-Site","none"),("Sec-Fetch-Mode","navigate"),("Sec-Fetch-User","?1"),("Sec-Fetch-Dest","document"),("Accept-Language","en-GB,en-US;q=0.9,en;q=0.8"),("Cookie","csrftoken=DqjsmpYULnGiclihz5eZupoI0lXdqS1xEKpAV6S02UH89JdJ5I7wRgboCaOVNfhB; sessionid=6a25f811hc2xicxwb25s252mmrc4kd7k"),("accept-encoding","identity")]
  path                 = "/"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 0
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (ConnectionFailure Network.Socket.connect: <socket: 42>: does not exist (Connection refused))
kozak commented 2 years ago

Thanks for the report, so the issue was that the port is not properly parsed from the request to be proxied. Resulting in a request to port 80 instead of the desired one. Fixed on master, new release will happen automatically once the build completes.

kozak commented 2 years ago

https://github.com/restaumatic/vcr-proxy/releases/tag/v0.4.0.0