Create proxy settings.
Return value
string Apache httpd.conf settings for the s3fs module.
1 call to advagg_install_s3fs_proxy_settings()
- advagg_install_chk_urls dans ./
advagg.install - Make sure http requests to css/js files work correctly.
Fichier
-
./
advagg.install, line 2886
Code
function advagg_install_s3fs_proxy_settings() {
list($css_path, $js_path) = advagg_get_root_files_dir();
$position = strpos($css_path[0], '://');
$dir = '';
if ($position !== FALSE) {
$dir = substr($css_path[0], $position + 3);
}
$css_target = str_replace($dir, '', file_create_url($css_path[0]));
$position = strpos($js_path[0], '://');
$dir = '';
if ($position !== FALSE) {
$dir = substr($js_path[0], $position + 3);
}
$js_target = str_replace($dir, '', file_create_url($js_path[0]));
$scheme = parse_url($js_target, PHP_URL_SCHEME);
$config = '';
$extra = '';
if ($scheme === 'http') {
$port = '80';
}
elseif ($scheme === 'https') {
$port = '443';
$extra = " SSLProxyEngine on\n";
}
$config .= "<VirtualHost *:{$port}>\n";
$config .= " ProxyRequests Off\n";
$config .= $extra;
$config .= " <Proxy *>\n";
$config .= " Order deny,allow\n";
$config .= " Allow from all\n";
$config .= " </Proxy>\n";
$config .= " ProxyTimeout 4\n";
$config .= " ProxyPass {$GLOBALS['base_path']}s3fs-css/ {$css_target}\n";
$config .= " ProxyPassReverse {$GLOBALS['base_path']}s3fs-css/ {$css_target}\n";
$config .= " ProxyPass {$GLOBALS['base_path']}s3fs-js/ {$js_target}\n";
$config .= " ProxyPassReverse {$GLOBALS['base_path']}s3fs-js/ {$js_target}\n";
$config .= " ProxyErrorOverride On\n";
$config .= "\n ErrorDocument 404 {$GLOBALS['base_path']}index.php\n";
$config .= "</VirtualHost>\n";
return $config;
}