【发布时间】:2016-12-13 10:08:18
【问题描述】:
我遇到了一个问题,即传递给我的 Elastic Beanstalk 环境的某些 URL 在 URL 的参数中包含斜杠,例如:
https://example.com/param1=this/that/param2=....
这些 URL 在我的应用程序可以在本地测试中正确处理斜线的上下文中有效。在 EB 上的生产中,Apache 服务器 EB 用作默认解码斜杠,导致 404 返回给用户。我对我的 Apache 知识不是很了解。在环境启动时动态设置参数的最佳和最有效方法是:AllowEncodedSlashes NoDecode 在我的 Apache 配置中?
显然,通过 SSH 连接到我的实例以进行更改远非理想,并且不会持续超过重新加载。是否可以以某种方式使用我的应用程序 .ebextensions 进行设置?
编辑:
为了提供更多详细信息,我正在使用负载平衡的 EB 环境,该环境使用 HTTPS 并正在运行 Django 应用程序(使用 mod_wsgi)
这是我的 wsgi.conf 文件,取自我的一个实例:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/baselinenv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On
<VirtualHost *:80>
Alias /static/ /opt/python/current/app/static/
<Directory /opt/python/current/app/static/>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / /opt/python/current/app/test_app/wsgi.py
AllowEncodedSlashes NoDecode
<Directory /opt/python/current/app/>
Require all granted
</Directory>
WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
python-path=/opt/python/current/app:/opt/python/run/venv/lib64/python3.4/site-packages:/opt/python/run/venv/lib/python3.4/site-packages user=wsgi group=wsgi \
home=/opt/python/current/app
WSGIProcessGroup wsgi
</VirtualHost>
LogFormat "%h (%{X-Forwarded-For}i) %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
这是我必须编辑的文件吗? EB enviornemnt 不会在环境重启时覆盖我的更改吗?
【问题讨论】:
标签: apache amazon-web-services url amazon-elastic-beanstalk