Yii reverse proxy site

I’ve developped a simple test site that works fine internally but when I publish it it’s accessible only via a reverse proxy.

So internally the site runs on http://webserver:8087/

Externally to access it you goto https://webserver/mytestsite

Now the first page loads fine after i redid the css and image links to refer to the correct file without the starting slash. But when I in the controller for example do:

$this->redirect(array("site/somepage", 'sid'=>$value));

It will redirect to: https://webserver/index.php?r=site/somepage&sid=1 <-- wrong

instead of https://webserver/mytestsite/index.php?r=site/somepage&sid=1 <— correct

How would you guys recommend I fix this ?

What exactly is the problem, that you loose 8087?

That is strange, I have a working copy that use localhost:8080 and all works properly.

Maybe is just a problem of host configuration on your machine, why don’t you change the internal name to something else, like localhost or anything different to webserver?

Found one way to do this in main.php the config file:





It doesn’t work for everything but the main site navigation stuff works now so thats the most important part.

The above links got shortened so that kind of ruined the point. The problem is that it if the extranal site is located behind a reverse proxy and you need to refer to it as https://somedomain/sitename and internally you can access it at http://webdevelopment:<port> so the sitename part is needed externally and internally it’s the root folder.

so instead of https://somedomain/sitename/index.php you end up at https://somedomain/index.php and at the root of the address there is a different reverse proxy configuration and it points to a different internal address.

Hi Bent, were you able to solve this?

I am having exactly the same problem. Trying to reverse proxy through a subdirectory.