跳至主要內容
版本:v8

使用代理

Ionic CLI 內建代理支援。代理設定可以透過設定檔或環境變數進行配置。

若要透過設定檔配置代理設定,請執行以下命令,並輸入代理伺服器的 URL:

ionic config set -g proxy http://proxy.example.com:8888

若要透過環境變數配置代理設定,請使用以下其中一個:

$ export HTTP_PROXY="http://proxy.example.com:8888" # also used by npm
$ export HTTPS_PROXY="https://proxy.example.com:8888" # also used by npm
$ export IONIC_HTTP_PROXY="http://proxy.example.com:8888"

其他 CLI

您使用的每個 CLI 都必須單獨配置以代理網路請求。

npm

npm config set proxy http://proxy.company.com:8888

git

git config --global http.proxy http://proxy.example.com:8888

SSL 設定

可以配置 Ionic CLI 使用各種 SSL 設定進行 HTTP 請求。

$ ionic config set -g ssl.cafile /path/to/cafile # file path to your CA root certificate
$ ionic config set -g ssl.certfile /path/to/certfile # file path to a client certificate
$ ionic config set -g ssl.keyfile /path/to/keyfile # file path to a client key file

cafilecertfilekeyfile 條目可以在 ~/.ionic/config.json 中手動編輯為字串陣列,以包含多個檔案。