Yii Framework Forum: Yii Behind a reverse proxy with SSL - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Behind a reverse proxy with SSL Rate Topic: -----

#1 User is offline   mrkmg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 10-January 11

Posted 30 July 2012 - 10:14 AM

If you are hosting Yii behind a reverse proxy, for example nginx, and you are having issues with your logs showing the proxies IP, or the urls being created arn't being created for SSL because your SSL certs are located on your reverse proxy instead of the Yii server, this code may be able to help you. I placed them in the very top of Yii's entry script, index.php

$_SERVER['SERVER_PORT'] = 443;
$_SERVER['HTTPS'] = 'on';
if(isset($_SERVER['HTTP_X_REAL_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];


Make sure your reverse proxy added the HTTP_X_REAL_IP header to the request. There is much documentation on this all over the web.
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users