我想这样的事情:
每次向http://example.com/front1/提出申请都会从s3桶中获取内容。
每次向http://example.com/front2/的请愿都会从另一个s3桶中获取内容。
每次向http://example.com/microservice1/请愿都会从微服务中获取内容。
每次向http://example.com/microservice2/的请愿都会从另一个微服务中获取内容。
对http://example.com/的其他请愿从另一个s3桶中获取内容。
它适用于具有如下虚拟主机的apache:
<VirtualHost *:80>
ServerName example.com
## Vhost docroot
DocumentRoot "/tmp"
<Directory "/tmp">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
## Logging
ErrorLog "/var/log/apache2/example.com_error.log"
ServerSignature Off
CustomLog "/var/log/apache2/example.com_access.log" "forwarded"
## Proxy rules
ProxyRequests Off
ProxyPreserveHost Off
ProxyPass /front1/ http://front1.s3-website-eu-west-1.amazonaws.com/
ProxyPassReverse /front1/ http://front1.s3-website-eu-west-1.amazonaws.com/
ProxyPass /front2/ http://front2.s3-website-eu-west-1.amazonaws.com/
ProxyPassReverse /front2/ http://front2.s3-website-eu-west-1.amazonaws.com/
ProxyPass /microservice1/ http://my-alb.com/microservice1/
ProxyPassReverse /microservice1/ http://my-alb.com/microservice1/
ProxyPass /microservice2/ http://my-alb.com/microservice2/
ProxyPassReverse /microservice2/ http://my-alb.com/microservice2/
ProxyPass / http://front-default.s3-website-eu-west-1.amazonaws.com/
ProxyPassReverse / http://front-default.s3-website-eu-west-1.amazonaws.com/
</VirtualHost>
但我试图不要有一个apache,我试图用aws api网关做到这一点。
问题是我无法正确服务,例如图像。似乎api网关准备用于检索json的调用。
我是对的?
有没有其他解决方案没有Web服务器?
非常感谢你。
我认为你可以使用Route53和ALB混合使用。
在example.com下为每个S3存储桶设置Route53别名记录,并将这些存储桶配置为静态S3网站。
然后将Route53 Alias记录设置为基于路径的ALB,并向此ALB添加两个侦听器 - 一个路由到/ microservice1 / *上的microservice1的TargetGroup和路径/ microservice2 / *上的另一个路由到Microservice 2
这非常简单,无需Web服务器进行调解。