AWS 弹性豆茎 "Request-URI Too Long"
aws elastic beanstalk "Request-URI Too Long"
我在 Elastic Beanstalk 上安装了 运行 一个 python Flask 应用程序。我的问题是我收到此 414 错误代码。我已将 LimitRequestLine 200000
添加到 httpd.conf
,并在 ec2 实例的 shell 上使用 sudo httpd service restart
重新启动,但它似乎没有成功..
这非常适用于 ec2 上的 apache 服务器 运行,而不是在 elastic beanstalk 上。也许负载均衡器是罪魁祸首?
我非常感谢对此的任何帮助...
另一个奇怪的事情 - 如果我从 ec2 实例上的 shell 重新启动 httpd 服务,长 uri 可以通过一次,而且只有一次 - 第二次我再次获得 414..
谢谢
LimitRequestLine
应该位于 <VirtualHost>
部分。在 Elastic Beanstalk 中执行此操作非常棘手,因为您需要将此行添加到自动生成的 /etc/httpd/conf.d/wsgi.conf
after commands
和 container_commands
都是 运行。按照 this 博客的想法,将以下内容添加到 .ebextensions
下的配置文件中:
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_adjust_request_limit.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
sed -i.back '/<VirtualHost/aLimitRequestLine 100000' /etc/httpd/conf.d/wsgi.conf
supervisorctl -c /opt/python/etc/supervisord.conf restart httpd
另一种方法是直接修改负载均衡器以增加参数"large_client_header_buffers"。这可能需要一个应用程序负载均衡器(与默认的经典负载均衡器相比)。
例如在文件夹 .ebextensions
中创建文件 files.config
files:
"/etc/nginx/conf.d/proxy.conf":
mode: "000755"
owner: root
group: root
content: |
large_client_header_buffers 16 1M;
我在 Elastic Beanstalk 上安装了 运行 一个 python Flask 应用程序。我的问题是我收到此 414 错误代码。我已将 LimitRequestLine 200000
添加到 httpd.conf
,并在 ec2 实例的 shell 上使用 sudo httpd service restart
重新启动,但它似乎没有成功..
这非常适用于 ec2 上的 apache 服务器 运行,而不是在 elastic beanstalk 上。也许负载均衡器是罪魁祸首?
我非常感谢对此的任何帮助...
另一个奇怪的事情 - 如果我从 ec2 实例上的 shell 重新启动 httpd 服务,长 uri 可以通过一次,而且只有一次 - 第二次我再次获得 414..
谢谢
LimitRequestLine
应该位于 <VirtualHost>
部分。在 Elastic Beanstalk 中执行此操作非常棘手,因为您需要将此行添加到自动生成的 /etc/httpd/conf.d/wsgi.conf
after commands
和 container_commands
都是 运行。按照 this 博客的想法,将以下内容添加到 .ebextensions
下的配置文件中:
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_adjust_request_limit.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
sed -i.back '/<VirtualHost/aLimitRequestLine 100000' /etc/httpd/conf.d/wsgi.conf
supervisorctl -c /opt/python/etc/supervisord.conf restart httpd
另一种方法是直接修改负载均衡器以增加参数"large_client_header_buffers"。这可能需要一个应用程序负载均衡器(与默认的经典负载均衡器相比)。
例如在文件夹 .ebextensions
中创建文件 files.configfiles:
"/etc/nginx/conf.d/proxy.conf":
mode: "000755"
owner: root
group: root
content: |
large_client_header_buffers 16 1M;