I am working on a site which just started using a CDN to deliver static content. However when CDN was turned on, the AJAX file uploads for CCK file image fields stopped working. An apache module mod_CDN (by voxel) rewrites all URLs in the generated html code with cdn.sitename including those of all included javascript files.

When I turned off the mod_cdn the AJAX upload started working again.

Content Construction Kit (CCK): 6.x-2.5

Would the domain from where the js file gets loaded change the behavior of the AJAX upload function?

Comments

quicksketch’s picture

Category: bug » support

Would the domain from where the js file gets loaded change the behavior of the AJAX upload function?

No this would not have any effect. My guess is that the POST submission when the upload button is clicked might be getting intercepted by your CDN, or the cached page result is being returned regardless of POST. If you have a way to exclude paths from your CDN, try adding "filefield/*" to the list of URLs that are never served by you CDN. You might also see if the AJAX used in the Views interface is similarly affected.

anoopjohn’s picture

I turned off URL rewriting for all javascript paths for the mod_cdn module. The error still persisted. There is a possibility that the issue was due to the mod_cdn module. I have taken this up with the voxel guys. Will post back with updates when I get them. It looks like they will have a new release soon.

quicksketch’s picture

I turned off URL rewriting for all javascript paths for the mod_cdn module.

The path underneath "/filefield/*" is not a JavaScript file, it's where FileField posts AJAX requests during the uploads. What I'm suggesting is that you disable the CDN underneath that path, not that you disable the CDN for JavaScript paths (which I assume is paths that end in *.js).

emcee0’s picture

Any update on this ticket? I'm curious too as were in the process of implemented mod_cdn.

wim leers’s picture

Probably this is because browsers are now considering this a cross-domain AJAX request, which is a violation of the same origin policy. If that's the case, the JS that does the AJAX request should be altered into a JSONP request, which will allow for cross-domain requests.

quicksketch’s picture

Status: Active » Closed (fixed)

Closing after lack of activity.

anoopjohn’s picture

I had disabled CDN for javascript files because I had problems with IMCE as well. So I didn't get to explore this issue after that. Keeping the issue closed.

Thanks
Anoop