編集する:

編集する:

私のhaproxyサーバーは、ルールに従って要求を別のWebサービスインスタンスにルーティングします。 Webサービスインスタンスはポート80でApacheを実行します。今mod_expires

これは私のアイテムですhttpd.conf

ExpiresActive On

ExpiresByType text/html                     "access plus 24 hours"

ExpiresByType text/htm                      "access plus 24 hours"

ExpiresByType image/gif                     "access plus 24 hours"

ExpiresByType application/json              "access plus 24 hours"

max-ageサーバーIPに直接接続してみると、キャッシュ制御に設定されていることを確認できます。ただし、haproxyを介してキャッシュ制御ヘッダーは設定されません。彼らはいつも「生き続ける」。haproxyポート80のApacheサーバーに要求をルーティングします。

私は走っていますCentOS 6

haproxyこれをサポートするにはいくつかの構成が必要ですか?どんなアドバイスも本当にありがとうございます。

編集する:

これがhaproxy構成です。


#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode        http
#    log         global
    option      dontlognull
    option      httpclose
    option      httplog
    option      forwardfor
    option      redispatch
    timeout connect 10000 # default 10 second time out if a backend is not found
    timeout client 300000
    timeout server 300000
    monitor-uri /index.html
    maxconn     60000
    retries     3

#
# Host HA-Proxy's web stats on Port 81.
listen stats :1936
    mode http
    stats enable
    stats hide-version
    stats realm Haproxy\ Statistics
    stats uri /
    stats auth Username:Password

#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend  main *:80
    log 127.0.0.1 local2
    capture request  header    X-Forwarded-For      len 500
    capture request  header    Host                 len 500
    capture response header    X-Query-Result       len 100
    acl url_webservice path_beg -i /community /toolkit /domain
    use_backend webservice          if url_webservice
backend webservice
    balance     roundrobin
    server      webservice1 xx.xx.xx.xxx:80 check

-ありがとう、シャミック

ベストアンサー1

おすすめ記事