I'm running Drupal in an intranet which is behind a simple HTTP proxy. I'd like for the module and core update checks to actually work.

I seem to remember there was a core hack to do this on Drupal 6, but I can't find the page anymore.

Does anyone know how I can get this working?

4 Answers 4


One of our corporate installations had a forward proxy that prevented direct access to the internet, we ended up patching core with 'the proxy patch' (thus named this way because this issue has been open since 2004 - http://drupal.org/node/7881).

http://drupal.org/node/7881#comment-4134240 - has a patch for drupal 7 http://drupal.org/node/7881#comment-2446280 - has a patch for drupal 6

Once the patch is installed, then you will be able to alter drupal_http_request() to send all queries through the proxy.

This way all modules that require access to the internet will function as expected, e.g. update statue, aggregator, openID etc

UPDATE: The patch is already merged in Drupal 7 trunk ( https://drupal.org/comment/6425278#comment-6425278 ), and hopefully will be out with Drupal 7.16

  • Perfect - that was the same page I got the D6 proxy patch for, but I seem to have missed it - thanks
    – Frederik
    Mar 24, 2011 at 16:12

For reference, this is the syntax you can now use in Drupal to configure it to run behind a proxy (from 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('', 'localhost');

There's a module for that

It's currently only Drupal 6, but should provide a good starting point.

  • Care you create the Drupal 7 version? (I can't believe anyone is still rolling out new sites with Drupal 6.)
    – iconoclast
    Jul 11, 2012 at 13:59

For resolving staging pbs, I'm working locally with the real production domain name, but behind a proxy, so that drupal installation and web server configuration are strictly identical (on some conf the IP listening could be different, depending on the listening ip in production).

So, I had a proxy responding for http://mydomain.local, proxying to http://www.mydomain.tld, but on a local IP.

Whith nginx, in local 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;

For the proxied vhost, just like in production

server_name  www.mydomain.tld;

And in my settings.php

if (isset($_SERVER['HTTP_X_PROXY_HOST'])) {
  $base_url = 'http://' .$_SERVER['HTTP_X_PROXY_HOST'];

With this conf, I can sync all drupal files AND database AND server configuration between a lot of drupal installation (dev and production in my case but could be whatever you want).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.