How to make http request through proxy server (Google App Script / JavaScript)

Viewed 1316

I use google app script (where we usually use almost raw js, without libs and etc). So I need to use proxy server (need dynamic-changing ip address).

But when i make request, proxy server calls back

This is a proxy server. Does not respond to non-proxy requests.

In common way, making http request in google app scrip seems like this:

 function make_some_request() {
  const url = 'https://www.google.com/';
  
  var headers = {
    "Content-Type" : "application/json; charset=utf-8",
  }
  
  var payload = []; // some data if we need post request
  
  var options = {
    "method"  : "POST",
    'headers' : headers,
    'payload' : JSON.stringify(payload)
  };
  
  try {
    
    var response = UrlFetchApp.fetch(url, options);
    return JSON.parse(response);
    
  } catch (error) {
    log("make_some_request", "ERROR: " + error);
  }
}

So, i can't understand what should i make with my request to use proxy server. How we make call through proxy server in common way (in raw HTTP). What headers or payload should i send to make this request a proxy-request?

P.S. as i know, google app script doesn't support another classes to make https requests. So all i have is almost raw HTTP.

0 Answers
Related