Apache HTTP 代理服务器使用 Postgresql 认证用户

<VirtualHost *:80>
	ServerName proxy.example.org
	ServerAdmin proxymaster@example.org

	DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/proxy_error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/proxy_access.log combined

	ProxyRequests On
	ProxyVia On
	<Proxy *>
		Order deny,allow
		Allow from all

		AuthType Basic
		AuthName proxy.example.org

		Auth_PG_host postgresql.example.org
		Auth_PG_port 5432
		Auth_PG_user myusername
		Auth_PG_pwd mypassword
		Auth_PG_database mydatabase

		Auth_PG_pwd_table http_proxy_user
		Auth_PG_uid_field username
		Auth_PG_pwd_field unix_crypt_password

		Auth_PG_log_table http_proxy_access_log
		Auth_PG_log_uname_field username
		Auth_PG_log_date_field date
		Auth_PG_log_uri_field request
		Auth_PG_log_addrs_field ip_address

		Require valid-user
	</Proxy>

</VirtualHost>

参考文档:

#apache-http-server, #http-proxy, #mod_auth_pgsql, #mod_proxy