# Drupal 7 and Coldfusion Proxy

**URL:** <https://www.ruby-forum.com/t/drupal-7-and-coldfusion-proxy/244787>\
**Category:** NGINX\
**Created:** [June 14, 2016, 5:02pm UTC](https://www.ruby-forum.com/t/drupal-7-and-coldfusion-proxy/244787 "2016-06-14T17:02:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [June 14, 2016, 5:02pm UTC](https://www.ruby-forum.com/t/drupal-7-and-coldfusion-proxy/244787/1 "2016-06-14T17:02:24Z")

</div>

Good morning everyone!

```
I have an issue that I am hoping is just a simple error on my part 

```

and  
the collective wisdom of the gurus here might solve it.

```
My setup : RHEL 7, Nginx 1.10, PHP 7 and Drupal 7

My issue : trying to serve seamless paths for both Drupal and

```

ColdFusion without having to specify every possible path that coldfusion  
applications exist in. I was hoping index.cfm would be automatically  
used  
via the index parameters but apparently only when try\_files contains  
$uri/. However that breaks drupal paths that aren’t physical folders…

```
The following config works - but as you can see the regex listing 

```

for  
coldfusion application paths is less than stellar…

root /var/www/drupal;  
index index.html index.php index.cfm;

location / {  
try\_files $uri /index.php?$query\_string; # For Drupal \>= 7  
}

location @rewrite {  
rewrite ^/(.\*)$ /index.php?q=$1;  
}

location ~ ^/sites/.\*/files/styles/ {  
try\_files $uri @rewrite;  
}

location ~\* .php$ {  
##  
# Fastcgi cache  
##  
set $skip\_cache 1;  
if ($cache\_uri != “null cache”) {  
add\_header X-Cache-Debug “$cache\_uri $cookie\_nocache  
$arg\_nocache$arg\_comment $http\_pragma $http\_authorization”;  
set $skip\_cache 0;  
}  
fastcgi\_cache\_bypass $skip\_cache;  
fastcgi\_cache evcccache;  
fastcgi\_cache\_key $scheme$host$request\_uri$request\_method;  
fastcgi\_cache\_valid any 5m;  
#fastcgi\_cache\_use\_stale updating;  
fastcgi\_cache\_bypass $http\_pragma;  
fastcgi\_cache\_use\_stale updating error timeout invalid\_header  
http\_500;  
try\_files $uri $uri/ =404;  
fastcgi\_split\_path\_info ^(.+.php)(/.+)$;  
include fastcgi\_params;  
fastcgi\_read\_timeout 300;  
fastcgi\_param SCRIPT\_FILENAME $document\_root$fastcgi\_script\_name;  
fastcgi\_pass unix:/var/run/php-fpm.sock;  
fastcgi\_intercept\_errors on;  
}

# ColdFusion Proxy

##################  
#find /var/www/drupal -type f -name ‘index.cfm’ |sed ‘s#(._)/._#\1#’  
|sort -u  
location ~\* .(cfm|cfc)$ {  
proxy\_pass https://coldfusion\_servers;  
proxy\_redirect off;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Forwarded-Host $host;  
proxy\_set\_header X-Forwarded-Server $host;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_intercept\_errors on;  
}

location ~\*  
^(/longpath/someapp|/anotherpath/anotherapp|/yetanotherpath/andanotherapp|anotherapppath/etcapp)  
{  
proxy\_pass https://coldfusion\_servers;  
proxy\_redirect off;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Forwarded-Host $host;  
proxy\_set\_header X-Forwarded-Server $host;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_intercept\_errors on;  
}

~Jeremy

---

<div class="post-metadata">

**Author:** ![Jeremiah\_Brock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@Jeremiah\_Brock](https://www.ruby-forum.com/u/Jeremiah_Brock)\
**Post date:** [June 15, 2016, 12:00am UTC](https://www.ruby-forum.com/t/drupal-7-and-coldfusion-proxy/244787/2 "2016-06-15T00:00:04Z")

</div>

On Tue, Jun 14, 2016 at 08:01:36AM -0700, Jeremiah Brock wrote:

Hi there,

> ```
> My issue : trying to serve seamless paths for both Drupal and
> 
> ```
> 
> ColdFusion without having to specify every possible path that coldfusion  
> applications exist in.

You may find it easiest to have a simple split in your url hierarchy  
– perhaps have everything that should be handled by drupal be below  
/drupal/; or have everything that should be handled by coldfusion be  
below /coldfusion/; or do both of them.

nginx is not magic.

If you mix your urls with no easy way to know which should be handled by  
drupal and which by coldfusion and which by something else, then you end  
up with a complicated way to tell nginx how it should handle each  
request.

> I was hoping index.cfm would be automatically used  
> via the index parameters but apparently only when try\_files contains  
> $uri/. However that breaks drupal paths that aren’t physical folders…

I don’t fully follow what you mean by that paragraph.

I suspect that that does not matter.

A request comes in. You want nginx to handle it in a particular way. The  
way you tell nginx how to handle it is by writing in nginx.conf.

> ```
> The following config works - but as you can see the regex listing for
> 
> ```
> 
> coldfusion application paths is less than stellar…

That is:

> location ~\*

^(/longpath/someapp|/anotherpath/anotherapp|/yetanotherpath/andanotherapp|anotherapppath/etcapp)

That suggests that a request for /longpath/something should be handled  
by drupal and not by coldfusion, yes?

And (with the rest of your config) a request for /longpath/someapp/a.php  
should be handled by drupal too.

If you want to mix urls in a complicated way, you’re going to have to  
unmix them in a complicated way in nginx.conf.

If you don’t want to unmix them in a complicated way in nginx.conf,  
the easiest thing to do is not to mix them in a complicated way in the  
first place.

I suppose you _could_ (at the cost of significant efficiency, I suspect)  
proxy everything to coldfusion, and then handle any 404 responses by  
trying drupal. That might lead to a smaller or less-frequently-updated  
nginx.conf.

But if you have the option to reorganise at least one of the “upstream”  
url hierarchies, I’d suggest doing that instead.

Good luck with it,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Jeremiah\_Brock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@Jeremiah\_Brock](https://www.ruby-forum.com/u/Jeremiah_Brock)\
**Post date:** [June 15, 2016, 12:11am UTC](https://www.ruby-forum.com/t/drupal-7-and-coldfusion-proxy/244787/3 "2016-06-15T00:11:45Z")

</div>

Thank you for the response Francis.

Unfortunately - I don’t have the luxury of separating out via a  
hierarchy.

I have determined that what I am wanting to do is just simply not  
possible  
: ( .

~Jeremy
