Tip: Drupal Behind a Proxy

Before setting up my Linux servers for my development environments, I was using a WAMP (Windows, Apache, MySQL & PHP) stack to do Drupal development. The workings of the site on my local dev machine was exactly the same as the live site. All I needed to do was FTP files between the two to make updates and changes.

Recently, I moved away from the WAMP stack and created a proper LAMP (Linux, Apache, MySQL & PHP) server. However, this server is not internet facing, and therefore requires a proxy server to access outside resources. I use Squid for this. The configuration of the Squid proxy was quite simple (let me know in the comments if you’d like me to write tutorial on this). However after installing the Drupal site on my LAMP server, I noticed there were some issues that were not present with the WAMP stack. After researching, I found out that it was because I was using a proxy server between Drupal and the internet, and I had not configured it in Drupal.

I was reluctant to make any changes at the file level for this, as this is an issue only within my development environment – I should solve the issue causing the problem, and not band-aid it with code. What I really wanted was a way to turn a proxy on and off from the UI. Then I found the Drupal http_proxy module. This does exactly what I was after: it allows me to enter the details of a proxy server from the Drupal website itself. So when I download the site to my server for development, I simply add the details of my Squid server into the proxy admin page. Then, before uploading the file and database changes I’ve made to the live server, I remove the details of the proxy. As a final step in my deployment checklist, I check the settings of the proxy on the live site to make sure the setting has been removed (or manually disable the module).

This has worked great for me and allows me to keep my LAMP development server off my main network without a problem, and I don’t need to resort to hard wired coding to deal with my internal proxy.

This entry was posted in Drupal and tagged , , , . Bookmark the permalink.

One Response to Tip: Drupal Behind a Proxy

  1. Prince says:

    Hey I know this is off topic but I was wondering if you knew of any
    widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your
    blog and I look forward to your new updates.

Add a comment...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s