Posts

Showing posts with the label proxy

curl HTTPS via an SSH proxy

Image
Clash Royale CLAN TAG #URR8PPP curl HTTPS via an SSH proxy I want the below curl command to run from my machine, but via a remote proxy server. curl "https://site.fake/ping" However, I want this to always work via a remote proxy server. I was tring to set this up with an ssh tunnel: sudo ssh -i ~/.ssh/private_key_file -L 443:site.com:443 username@remote.proxy.com But this did not do the trick, running under osx. Any suggestions? 1 Answer 1 Try using a socks5 proxy for example: socks5 $ ssh -D 8080 -f -C -q -N user@remote.host Then you could use curl like this: curl curl -x socks5h://0:8080 https://example.com By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Modify site content and render it in browser

Image
Clash Royale CLAN TAG #URR8PPP Modify site content and render it in browser I am writing a proxy for some site using ASP.NET Core 2.0. My proxy works fine if all it does is just re-translating HttpResponseMessage to the browser. My proxy based on this example. But I need to make some changes site content, for instance, some of the href contains an absolute reference. So when I click them from my proxy, I get to the original site, and it is a problem. HttpResponseMessage When I tried to get site HTML as a string, I got only special characters. After some search, I find this solution. It fits for my case well and I successfully get site content as a string, which starts with "<!DOCTYPE html>..." . After changes are done I need to send this string to my browser, and here I have a problem. I work with the HttpResponseMessage the following way: "<!DOCTYPE html>..." HttpResponseMessage using (var responseStream = await responseMessage.Content.ReadAsStreamAsy...