php - Silex redirects adding port 80 to location -
i have app using silex security firewall. when load app @ https://app.com/web , i'm not authenticated redirected https://app.com:80/web/user/login_check
this produces ssl error trying create ssl connection on non-ssl port.
my firewall config looks this,
$app['security.firewalls'] = array( 'login' => array( 'pattern' => '^/user/login$', ), 'admin' => array( 'pattern' => '^.*$', 'form' => array('login_path' => '/user/login', 'check_path' => '/user/login_check'), 'logout' => array('logout_path' => '/user/logout'), 'users' => array( // raw password demo 'test' => array('role_admin', 'qldd7mo0ol7e2lijc1qdnxqjpkidhqlpjhum0rn/n6ajehqgzzfsyph94r/aefrm8aet9y6l$ ), ), );
i know can access https://app.com/web/index.php without port beingness added not web server, when redirected /user/login page.
i read symfony doesn't utilize port in url 1 defined in _server server_port, setting
$_server['https'] = 'on'; $_server['server_port'] = 443;
doesn't help me.
the initial request redirects returns in headers,
request url:https://app.com/web/ request method:get status code:302 found
location:https://app.com:80/web/user/login
does know how stop silex's redirection adding port 80 location?
edit: should have mentioned running on redhat's openshift cloud infrastructure.
in theory should able solve setting "trusted proxies" on request described here http://symfony.com/blog/security-release-symfony-2-0-19-and-2-1-4
i've had problem when using cloudflare, though, has hundreds of ips impractical list them "trusted" simplest way i've been able solve problem. set @ top of bootstrap file before autoloader:
// prepare ip cloudflare if (isset($_server['http_cf_connecting_ip'])) { $_server['http_x_forwarded_for'] = $_server['http_cf_connecting_ip']; $_server['http_client_ip'] = $_server['http_cf_connecting_ip']; $_server['remote_addr'] = $_server['http_cf_connecting_ip']; } // prepare ssl cloudflare if (isset($_server['http_cf_visitor'])) { if (preg_match('/https/i', $_server['http_cf_visitor'])) { $_server['https'] = 'on'; $_server['http_x_forwarded_port'] = 443; $_server['server_port'] = 443; } }
php symfony2 silex openshift
No comments:
Post a Comment