@burgerga Your “proper” way is in fact less efficient, because now you’re proxying twice:
First through your own server (/scrape/).
Then via your server to CORS Anywhere.
From the browser’s point of view, the initial request is same-origin, so it does not automatically include the Origin header. If you really want to keep the current two indirections, add the X-Requested-With: XMLHttpRequest request header, either in Angular’s HTTP client, or through the proxy config.
@burgerga Your “proper” way is in fact less efficient, because now you’re proxying twice:
/scrape/).From the browser’s point of view, the initial request is same-origin, so it does not automatically include the
Originheader. If you really want to keep the current two indirections, add theX-Requested-With: XMLHttpRequestrequest header, either in Angular’s HTTP client, or through the proxy config.angular-cliuseswebpack-dev-serverunder the hood, which in turn useshttp-proxy-middleware, which in turn useshttp-proxy(which is the same library that I use under the hood for proxying). According to the documentation, the request header can be set via the"headers"option.Although you can achieve that desired behavior, I suggest to just rewrite the URL at the client side (in your Angular application). That is actually the proper place for this. This can be done automatically in Angular through a
$httpinterceptor: see https://docs.angularjs.org/api/ng/provider/$httpProvider and https://docs.angularjs.org/api/ng/service/$http#interceptors