相关配置为公司内环境配置,综合网关用squid模拟。
项目基本架构为:网关作为ICAP Client,ICAP Server用的是C-ICAP SERVER 0.2.5,往后为公司的业务系统,ICAP Server作用是在网关与业务系统之间作适配。
1、squid
squid支持ICAP Client,本次配置如下:
--------------------------------------------------------------------squid.conf--------------------------------------------------------------------
#Icap client for squid
icap_enable on
icap_preview_enable on
icap_preview_size 1024
icap_206_enable off
icap_send_client_ip on
#将HTTP回复发送给icap服务器
icap_service service_res respmod_precache 1 icap://192.168.0.246:1344/ToolbarInsertion
#将HTTP请求发送给icap服务器
icap_service service_req reqmod_precache 0 icap://192.168.0.246:2344/ex206
adaptation_access service_res allow all
adaptation_access service_req allow all
--------------------------------------------------------------------end--------------------------------------------------------------------
ToolbarInsertion:RESPMOD请求URI;
ex206:REQMOD请求URI;
2、icap
icap支持OPTIONS、REQMOD、RESPMOD(参考RFC3507);
ToolbarInsertion配置文件:srv_xxxxxxx.conf
--------------------------------------------------------------------srv_xxxxxxx.conf--------------------------------------------------------------------
#
# To enable srv_xxxxxxx service in c-icap, copy this file in c-icap
# configuration directory and add the following line at the end of
# c-icap.conf file:
# Include srv_xxxxxxx.conf
#
# Module: srv_xxxxxxx
#
# Load the srv_xxxxxxx service:
Service wkcash_module srv_xxxxxxx.so
# Add the alias wkwsc for srv_xxxxxxx service. It is used by many
ServiceAlias ToolbarInsertion srv_xxxxxxx
# wk cash module settings
# TAG: srv_xxxxxxx.EmbedHtmlContentTypes
# Format: srv_xxxxxxx.EmbedHtmlContentTypes type1 [type2] ...
# Description:
# the list of Content types or groups of Content types which will be
# Embed. For supported types look in c-icap.magic
# configuration file.
# Default:
# text/html application/vnd.wap.xhtml+xml application/xhtml+xml.
srv_xxxxxxx.EmbedHtmlContentTypes text/html application/vnd.wap.xhtml+xml application/xhtml+xml
# TAG: srv_xxxxxxx.EmbedWmlContentTypes
# Format: srv_xxxxxxx.EmbedWmlContentTypes type1 [type2] ...
# Description:
# the list of Content types or groups of Content types which will be
# Embed. For supported types look in c-icap.magic
# configuration file.
# Default:
# text/vnd.wap.wml
srv_xxxxxxx.EmbedWmlContentTypes text/vnd.wap.wml
# TAG: srv_xxxxxxx.CashMereServer
# Format: srv_xxxxxxx.CashMereServer Host Port
# Description:
# The CashMere Server Host Information
# Default:
# localhost 18080
srv_xxxxxxx.CashMereServer 192.168.0.246 8090
#srv_xxxxxxx.CashMereServer 192.168.0.246 80
#srv_xxxxxxx.CashMereServer 192.168.0.45 80
# TAG: srv_xxxxxxx.LocalMemCacheServer
# Format: srv_xxxxxxx.LocalMemCacheServer onoff
# Description:
# Set To Enable or Disable The Local Memcache Server
# Default:
# off
srv_xxxxxxx.LocalMemCacheServer off
# TAG: srv_xxxxxxx.MemCacheServer
# Format: srv_xxxxxxx.MemCacheServer Host Port
# Description:
# The Memcache Server Host Information
# Default:
# localhost 11211
srv_xxxxxxx.MemCacheServer localhost 11212
#srv_xxxxxxx.MemCacheServer 192.168.0.45 11212
# TAG: srv_xxxxxxx.MemCacheExpireTime
# Format: srv_xxxxxxx.MemCacheExpireTime seconds
# Description:
# Set To Memcache Server ExpireTime
# Default:
# off
srv_xxxxxxx.MemCacheExpireTime 60
# TAG: srv_xxxxxxx.AccessLogPath
# Format: srv_xxxxxxx.AccessLogPath path
# Description:
# The Access Log Path Information
# Default:
# c-icap default log path
srv_xxxxxxx.AccessLogPath /home/src/c_icap-0.2.5_req_mod/var/log
srv_xxxxxxx.ServerGroup 1
# End module: srv_xxxxxxx
--------------------------------------------------------------------end--------------------------------------------------------------------
C-ICAP Server安装后配置文件在:etc/c-icap.conf
--------------------------------------------------------------------c-icap.conf--------------------------------------------------------------------
#
# This file contains the default settings for c-icap
#
#
# TAG: PidFile
# Format: PidFile pid_file
# Description:
# The file to store the pid of the main process of the c-icap server.
# Default:
# PidFile /var/run/c-icap/c-icap.pid
PidFile /var/run/c-icap/c-icap-req.pid
# TAG: CommandsSocket
# Format: CommandsSocket socket_file
# Description:
# The path of file to use as control socket for c-icap
# Default:
# CommandsSocket /var/run/c-icap/c-icap.ctl
CommandsSocket /var/run/c-icap/c-icap-req.ctl
# TAG: Timeout
# Format: Timeout seconds
# Description:
# The time in seconds after which a connection without activity
# can be cancelled.
# Default:
# Timeout 300
Timeout 300
# TAG: MaxKeepAliveRequests
# Format: MaxKeepAliveRequests number
# Description:
# The maximum number of reque