http-redirectapache2symfony1

Symfony 1.2 : weird redirection on a new server


When submiting a form, I've got this traces in the logs

Dec 06 14:43:23 symfony [info] {sfFrontWebController} Redirect to "http://example.com, example.com, example.com/myapp/backend_dev.php/post/1/edit"
Dec 06 14:43:23 symfony [info] {sfWebResponse} Send status "HTTP/1.1 302 Found"
Dec 06 14:43:23 symfony [info] {sfWebResponse} Send header "Location: http://example.com, example.com, example.com/myapp/backend_dev.php/post/1/edit"
Dec 06 14:43:23 symfony [info] {sfWebResponse} Send header "Content-Type: text/html; charset=utf-8"
Dec 06 14:43:23 symfony [info] {sfWebResponse} Send content (176 o)

The url displayed in the browser's adsress bar is : http://example.com, example.com, example.com/myapp/index.php/post/new

It is very weird since it works on my station (wampserver 2.0 and PHP 5.2.9).

I have no clues at the moment of the origin of this problem (except it never worked in this new environment - apache/ PHP 5.3).


Solution

  • phpinfo() did the trick!

    In the "Apache Environment" section I have

    X-Forwarded-Host mydomain, mydomain, mydomain

    In the "HTTP Headers Information" section I have the same

    X-Forwarded-Host mydomain, mydomain, mydomain

    Finally in the "PHP Variables" section

    _SERVER["HTTP_X_FORWARDED_HOST"] mydomain, mydomain, mydomain

    What's strange is that symfony choose this variable instead of $_SERVER["HTTP_HOST"] to generate absolute URL.

    EDIT : look at this bug http://trac.symfony-project.org/ticket/3842