7

Is there any way to configure proxy server in polymer-cli ? similar to webpack-dev-server proxy. I've check any possible documentation with no success

Adi Setiawan
  • 73
  • 1
  • 4

3 Answers3

5

There are two proxy options you can set when running polymer serve:

--proxy-path string Top-level path that should be redirected to the proxy-target. E.g. api/v1 when you want to redirect all requests of https://localhost/api/v1/.

--proxy-target string Host URL to proxy to, for example https://myredirect:8080/foo.

Starting with a proxy would look something like:

polymer serve --proxy-target http://localhost:3000 --proxy-path api
0

to configure polymer-cli proxy in Linux, just set environment variable:

if you using bash,

export http_proxy="http://[proxy_host]:[port]"
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
ibrohimislam
  • 717
  • 7
  • 21
0

Polymer uses bower. You can set proxy for bower and it will works fine. create .bowerrc in your current project and add these lines :

{ "directory": "bower_components", "proxy": "http://yourProxy:yourPort", "https-proxy":"http://yourProxy:yourPort", "no-proxy":"myserver.mydomain.com" }

Aymen
  • 1