我有一个部署到aws ecs集群的codeigniter项目。我有两个ec2实例,我正在使用一个负载均衡器,它稍后连接到路由53中的一个自定义域。在codeigniter项目中,我将config.php文件中的基变量设置为
$base = "https://".$_SERVER['HTTP_HOST'];当我使用http时,我会收到一个blocked:mixed-content错误,但是当我使用https时,当我使用我的自定义域名时,我不会得到一个错误。现在我的错误来了,当我尝试登录到应用程序时,我得到了太多重定向的错误。我试着在互联网上查看我发现的不清楚的例子。
下面是我的.htaccess文件内容
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]我还创建了一个docker映像,并在dockerfile中公开了端口80,然后在ecs的容器中放置了80:80tcp的端口映射
然后,负载均衡器还会打开端口80以打开web,然后打开自定义域
我希望应用程序在所有urls中使用https我不确定必须在哪里进行更改以便解决错误,提前谢谢
发布于 2021-02-01 15:47:23
你能试着按照你展示的样品来写吗?请确保在测试URL之前清除浏览器缓存。
DirectoryIndex index.php
RewriteEngine ON
RewriteBase /
RewriteCond https !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !(index\.php|robots\.txt)/?$ [NC]
RewriteRule ^(.*)$ index.php?/$1 [L]https://stackoverflow.com/questions/65988816
复制相似问题