I am trying to send GET request in javascript through my proxy server. My proxy server requires authorization, so I use Authorization: Bearer header. However, regardless of endpoint website I am sending GET request to, I always get 2 types of errors:
1)ERR_SSL_PROTOCOL_ERROR if I use HTTPS for my proxy server URL;
2)ERR_UNEXPECTED_PROXY_AUTH if I use HTTP for that purpose
My code:
const proxyURL = 'https://134.195.153.108:9870/'
const apiURL = 'https://httpbin.org/ip'
fetch(proxyURL + apiURL, {headers: {
'Authorization' : 'Bearer ' + btoa('username:password') // of course i put my real creds
}})
.then(response => response.json())
.then(data => {
console.log(data)
})
I tried different proxy servers even without required Authorization, I tried using Proxy-Authorization header instead of usual Authorization. And I tried many websites as an endpoint. For some reason in python configuring aiohttp.ProxyConnector
from aiohttp
I easily manage to receive data through my proxy server, however I need to do the same using pure javascript.