http_port 8080」と「https_port 8082」を使い分けるこの記事では、
http_portとhttps_portの違い、クライアント側の設定方法、運用パターン、トラブル時の確認ポイントを解説します。
http_port 8080 の動作https_port 8082 の動作(SSL Bump/透過)http_port と https_port の比較表http_port 8080 の動作役割:標準的な HTTPプロキシ。ブラウザ/OSで明示プロキシを設定して利用します。
HTTPSの扱い:CONNECT メソッドでトンネルを張り、中身は見えません。
通信フロー(概念)
Client --HTTP--> Squid(http_port) --HTTP/HTTPS--> Web
└─ HTTPSはCONNECTでトンネル
リクエスト例(ブラウザ→Squid)
GET http://www.example.com/ HTTP/1.1
Host: www.example.com


ポイント
https_port 8082 の動作(SSL Bump/透過)役割:TLS(HTTPS)をSquidで終端するためのポート。
主な用途:SSL Bump(復号検査)、透過HTTPSプロキシ。
通信フロー(概念)
Client --TLS(HTTPS)--> Squid(https_port) --TLS/HTTP--> Web
└─ 必要に応じて復号(ssl_bump)


ポイント
443 → 8082 にリダイレクト。http_port と https_port の比較表| 比較項目 | http_port 8080 |
https_port 8082 |
|---|---|---|
| 主な用途 | 通常のHTTP/HTTPSプロキシ | SSL Bump / 透過HTTPS |
| クライアント接続 | HTTP | HTTPS (TLS) |
| クライアント設定 | 明示プロキシ | 明示 or 透過(FW/NAT必須) |
| 暗号化(Client→Squid) | なし(平文) | あり(TLS) |
| 証明書配布 | 不要 | 必要(中間CA) |
| HTTPSの中身可視化 | 不可(CONNECTのトンネル) | 可能(bump時) |
http_port 8080 のみhttp_port 8080 + https_port 8082 ssl-bump ...tcp/443 → 8082、tcp/80 → 3128/8080 などにNAThttp_port のみ192.168.100.205:8080192.168.100.205:8080
https_port をHTTPSプロキシに192.168.100.205:8082192.168.100.205:8080)# /etc/squid/squid.conf
http_port 8080
# 例: 最低限のACL
acl allowed src 192.168.0.0/16
http_access allow allowed
http_access deny all
# /etc/squid/squid.conf
http_port 8080
https_port 8082 ssl-bump cert=/etc/squid/ssl_cert/myCA.pem key=/etc/squid/ssl_cert/myCA.key generate-host-certificates=on dynamic_cert_mem_cache_size=4MB
# Bump ポリシー例
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump bump all
# 基本のアクセス制御
acl allowed src 192.168.0.0/16
http_access allow allowed
http_access deny all
# 証明書DB(初回のみ)
# /etc/squid/ssl_cert/ssl_db を作る
# /usr/lib64/squid/security_file_certgen -c -s /etc/squid/ssl_cert/ssl_db -M 4MB
# /etc/squid/squid.conf
http_port 3128 intercept
https_port 8082 intercept ssl-bump cert=/etc/squid/ssl_cert/myCA.pem key=/etc/squid/ssl_cert/myCA.key generate-host-certificates=on
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump bump all
acl allowed src 192.168.0.0/16
http_access allow allowed
http_access deny all
※ 透過は FW/NATルール が必須。端末のデフォルトゲートウェイ上で実装するのが一般的。
http_port 8080 だけでOK。証明書配布なしで簡単。https_port 8082 でSSL Bump。ルートCA配布が必須。迷ったら:まずは http_port 8080 単独 で安定させる → その後、要件に応じて https_port(SSL Bump/透過)を段階的に追加するのがおすすめ。
# HTTP越しにGoogleのヘッダ取得(明示プロキシ8080)
curl -I -x http://192.168.100.205:8080 http://www.google.com
# HTTPSをCONNECTで通す(明示プロキシ8080)
curl -I -x http://192.168.100.205:8080 https://www.google.com
# 直接HTTPSでSquidへ(https_port 8082 にTLSで接続)
openssl s_client -connect 192.168.100.205:8082 -servername www.google.com