0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Cloud Proxy(ZScalerなど) 環境下のDify設定

0
Last updated at Posted at 2025-12-05

はじめに

Proxy環境下のDify設定 の方法でプロキシ関連の環境変数をdocker-compose.yamlにつらつらと書かなくよくなります。
この設定を少し変更して ZScaler のようなクラウドプロキシに対応する方法について記載します。

事前準備

WSLなどのホストPCからクラウドプロキシ経由でSSL通信できるようにしておく必要があります。
クラウドプロキシのルートCA証明書をホスト上に置いて証明書リストを更新します。

$ sudo cp ZScalerRootCA.crt /usr/local/share/ca-certificates/
$ sudo update-ca-certificates
$ curl https://marketplace.dify.ai   # <- SSL verify エラーにならなければOK

docker/ssrf_proxy/squid.conf.templete

プロキシ設定した箇所を外すのみ。
これで NO_PROXY 設定が要らなくなる。

## NO_PROXY向けに内部ネットワーク宛のアクセスを許可
acl localnet_dst dst 0.0.0.1-0.255.255.255      # RFC 1122 "this" network (LAN)
acl localnet_dst dst 10.0.0.0/8         # RFC 1918 local private network (LAN)
acl localnet_dst dst 100.64.0.0/10              # RFC 6598 shared address space (CGN)
acl localnet_dst dst 169.254.0.0/16     # RFC 3927 link-local (directly plugged) machines
acl localnet_dst dst 172.16.0.0/12              # RFC 1918 local private network (LAN)
acl localnet_dst dst 192.168.0.0/16             # RFC 1918 local private network (LAN)
acl localnet_dst dst fc00::/7           # RFC 4193 local private network range
acl localnet_dst dst fe80::/10          # RFC 4291 link-local (directly plugged) machines
http_access allow localnet_dst
http_access allow localnet

## 内部ネットワーク宛は直接アクセス
always_direct allow localnet_dst
always_direct allow localhost

docker/docker-compose.yaml

以下について設定。

  • api と plugin_daemon サービスに squid 経由するようプロキシ設定
  • ホストOS上のSSL証明書リストを api, plugin_daemon にも参照できるようにする
  • api サービス内で行う python httpx 用に SSL証明書ファイルを指定
  • plugin_daemon 内の uv を用いた pip インストール用に "--native-tls" オプションを指定
services:
  api:
    environment:
      HTTP_PROXY: ${SSRF_PROXY_HTTP_URL:-http://ssrf_proxy:3128}
      HTTPS_PROXY: ${SSRF_PROXY_HTTPS_URL:-http://ssrf_proxy:3128}
      SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
    volumes:
      - /etc/ssl/certs:/etc/ssl/certs

  plugin_daemon:
    environment:
      HTTP_PROXY: ${SSRF_PROXY_HTTP_URL:-http://ssrf_proxy:3128}
      HTTPS_PROXY: ${SSRF_PROXY_HTTPS_URL:-http://ssrf_proxy:3128}
      PIP_EXTRA_ARGS: "--native-tls"
    volumes:
      - /etc/ssl/certs:/etc/ssl/certs

これで Dify 1.10.0 でプラグインインストールができています。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?