特定域的 HA 代理替换标头不起作用

时间:2021-06-10 05:53:09

标签: acl haproxy

我在 HA 代理配置文件中添加了以下 acl 和后端:

acl app-web hdr(host) -i example.com
use_backend www-web if app-web

#For google fonts : /icon /css and url parameter 'family'
acl app-css path -i -m beg /css
acl app-cssurl urlp(family) -m found
use_backend www-fonts if app-css app-cssurl
use_backend www-fonts if { path_beg /icon }

#For static content serving from aws s3 bucket 
use_backend www-frontend if { path_beg /css /js /img /assets /corber /moment-locales /favicon.ico }


#web server backend serving nodejs app
backend www-web
        redirect scheme https if !{ ssl_fc }
        server webapp 10.0.0.1:8000 check

#backend for google fonts
backend www-fonts
        mode http
        option forwardfor
        http-request replace-header Host .* fonts.googleapis.com
        server www-fonts fonts.googleapis.com:443 ssl verify none

#backend for static content from s3 bucket
backend www-frontend
        mode http
        option forwardfor
        http-request replace-header Host .* staticbucket.s3.ap-south-1.amazonaws.com
        server www-frontend staticbucket.s3.ap-south-1.amazonaws.com:443 ssl verify none

现在,当我们点击 www.example.com url 时,谷歌字体和静态内容除外。但是如果我们没有任何子域,即 example.com,它就会调用 www-web 后端。谷歌字体和静态内容未加载。

我们应该进行什么配置以允许 example.com(无子域)提供来自 s3 和 google 字体的静态内容?

0 个答案:

没有答案
相关问题