题
我正在简单的HTTP代理后面的Intranet中运行Drupal。我想进行模块和核心更新检查以实际工作。
我似乎记得在Drupal 6上有一个核心黑客攻击,但是我再也找不到页面了。
有人知道我如何才能工作吗?
解决方案
我们的一项公司安装具有一个前向代理,可以阻止直接访问Internet,我们最终用“代理补丁”来修补Core(因此以这种方式命名,因为此问题自2004年以来已经开放 - http://drupal.org/node/7881).
http://drupal.org/node/7881#comment-4134240 - 有Drupal 7的补丁http://drupal.org/node/7881#comment-2446280 - 有Drupal 6的补丁
安装补丁后,您将能够更改Drupal_http_request()以通过代理发送所有查询。
这样,所有需要访问Internet的模块都将按预期运行,例如更新雕像,聚合器,OpenID等
更新: :该补丁已经在Drupal 7 Trunk中合并( https://drupal.org/comment/6425278#Comment-6425278 ),希望能与Drupal 7.16一起出去
其他提示
作为参考,这是您现在可以在Drupal中使用的语法将其配置为在代理后面运行(从 default.settings.php/7):
/**
* External access proxy settings:
*
* If your site must access the Internet via a web proxy then you can enter
* the proxy settings here. Currently only basic authentication is supported
* by using the username and password variables. The proxy_user_agent variable
* can be set to NULL for proxies that require no User-Agent header or to a
* non-empty string for proxies that limit requests to a specific agent. The
* proxy_exceptions variable is an array of host names to be accessed directly,
* not via proxy.
*/
# $conf['proxy_server'] = '';
# $conf['proxy_port'] = 8080;
# $conf['proxy_username'] = '';
# $conf['proxy_password'] = '';
# $conf['proxy_user_agent'] = '';
# $conf['proxy_exceptions'] = array('127.0.0.1', 'localhost');
有一个模块 ™
目前只有Drupal 6,但应该提供一个很好的起点。
对于解决分期PBS,我正在本地使用真实的生产域名,但是在代理后面,因此Drupal安装和Web服务器的配置严格相同(在某些conf上,IP侦听可能会有所不同,取决于听力IP生产)。
所以,我有一个代理回应 http://mydomain.local, ,代理 http://www.mydomain.tld, ,但在本地IP上。
nginx,在本地vhost conf中:
server_name mydomain.local;
set $proxied_server_name www.mydomain.tld;
set $proxied_cookie_domain mydomain.tld;
# then generic proxy conf
proxy_set_header Host $proxied_server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# My param added for drupal absolute url construction
proxy_set_header X-Proxy-Host $host;
# For headers rewriting (Location or Refresh)
proxy_redirect http://$proxied_server_name/ http://$host/;
proxy_cookie_domain $proxied_server_name $host;
# and for drupal auth, with cookies without sub-domain
proxy_cookie_domain $proxied_cookie_domain $host;
对于代理的VHOST,就像生产一样
server_name www.mydomain.tld;
在我的设置中
if (isset($_SERVER['HTTP_X_PROXY_HOST'])) {
$base_url = 'http://' .$_SERVER['HTTP_X_PROXY_HOST'];
}
使用此conf,我可以在许多Drupal安装之间(在我的情况下进行DEV和生产,但可能是您想要的),可以同步所有Drupal文件和数据库和服务器配置。