On my server i'm using nginx on port
8081
80
.org,.com,.net
$base_url
localhost:8081
domain.org
domain.com
$base_url="domain.com";
domain.org
$base_url
.com
$base_url
Thanks Charlotte for the tip.
After some search on the HTTP_HOST
server variable i discovered that apache
is passing the HTTP_HOST
to nginx as localhost:8081
.
I use reverse proxy in apache to make the proxy behavior:
ProxyPass / http://localhost:8081/
ProxyPassReverse / http://localhost:8081/
I searched the Documentation of apache and found a directive called ProxyPreserveHost
When enabled, this option will pass the Host: line from the incoming request to the proxied host, instead of the hostname specified in the ProxyPass line.
i enabled it by adding this line:
ProxyPreserveHost On
And it worked , now codeigniter can read HTTP_HOST
right and make the $base_url
right.