I've got a Drupal 7 site on Apache and Varnish, sitting behind the CloudFlare CDN. Everythin on mysite.com goes through cloudflare... I also have a "direct access" subdomain set up at direct.mysite.com, which is a CNAME alias that bypasses cloudflare.

One issue with Cloudflare is that it limits the upload size of files passing through its servers to 100MB. I want my users to be able to upload files that are larger than that.

What I would like to do is allow my users to add content like normal via mysite.com/add/node/type... but pipe the actual file uploads through to my direct subdomain (direct.mysite.com), so that the upload process itself (and only the upload process) bypasses CloudFlare, allowing files larger than 100 MB to be uploaded.

Any idea of how I would go about something like that?

I've tried a simple htaccess rewrite without any luck (the upload button seems to send the ajax request to the right place, but I get an "ajax http request terminated abnormally" error).

RewriteCond %{REQUEST_URI} ^/file/ [NC]
RewriteRule !^index\.php$ http://direct.mysite.com%{REQUEST_URI} [L,R]   
  • You must emulate your Drupal's AJAX functionality, and also make sure that upload progress is handled by the proper server - and as the latter is handled at the lower level, level of webserver's plugins, you cannot do it using only rewrite rules. Very difficult and unstable, if not simply impossible.
    – Mołot
    Apr 11, 2014 at 6:40
  • @Molot Yeah, I didn't think rewrite rules would do it. It seems strange to me that something like this would be "simply impossible," though, considering I am not talking about piping the file to a different server, or a different site: simply a subdomain which is an alias of the site itself... direct.mysite.com = www.mysite.com, except that it doesn't go through CloudFlare... surely there should be some way to simply send the ajax requests to direct.mysite.com? Apr 11, 2014 at 15:56


Your Answer

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

Browse other questions tagged or ask your own question.