Skip to content

Instantly share code, notes, and snippets.

@DeRain
Created August 25, 2016 13:17
Show Gist options
  • Save DeRain/80c6290de575a69154497efcd3cbae38 to your computer and use it in GitHub Desktop.
Save DeRain/80c6290de575a69154497efcd3cbae38 to your computer and use it in GitHub Desktop.
<?php
class UniusHttpRequest extends CHttpRequest
{
/**
* @var string Redirect path, should be configured in nginx virtual host
* @link http://kovyrin.net/2010/07/24/nginx-fu-x-accel-redirect-remote/
*/
public $outerRedirectUrl = '/outer_redirect';
/**
* @param string $outerUrl
*/
public function outerRedirect($outerUrl)
{
# This header will ask Nginx to get this url
header('X-Accel-Redirect: ' . $this->outerRedirectUrl . '/' . urldecode($outerUrl));
Yii::app()->end();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment