[英]How to remove server header from nginx response in elastic beanstalk
[英]How can I remove Elastic Beanstalk Apache server header from static content?
我有一个 Elastic Beanstalk AML 2 设置,运行一个 Apache 代理服务器。
通过以下文件扩展 httpd.conf,我已经成功地将服务器 header 从 GET 请求最小化到 /
.platform/httpd/conf.d/httpd.conf
内容是:
ServerSignature Off
ServerTokens Prod
这适用于页面请求,并且仅将“Apache”报告为我的服务器令牌/签名。
但是请求static内容(比如图片,css,js)还是报完整签名。
我如何将相同的内容应用于 static 内容?
在配置了 Apache httpd 的标准 AWS beanstalk 环境中,所有 web 内容(静态和动态)都将通过 httpd 提供(httpd 充当发送到 tomcat 或其他动态 web 内容的请求的代理)。
由于 ServerSignature 和 ServerTokens 是全局配置设置,如果此设置更改适用于某些页面,它也应该适用于所有 static 内容。
在应用相同的 Apache 设置后,我遇到了与您类似的问题,但这是因为浏览器从其自己的缓存中提供 static 内容(显示的server
header 来自我更改 Apache 之前的原始请求)。 我通过在浏览器上执行硬重新加载/刷新缓存来解决此问题。
您可以通过 ssh 连接到您的 EC2 服务器并运行来验证 httpd 是否正常工作
# Check page (update to the dynamic page you want to test)
curl -I localhost/path/mypage
# Check image/css (update path to the static resource you want to test)
curl -I localhost/img/test.png
# In Apache/Tomcat, you can view the Tomcat page directly
# (but note that your browser will not see this directly, it will be proxied via httpd)
curl -I localhost:8080/path/mypage
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.