WordPress.org

Support

Support » Plugins and Hacks » [Plugin: W3 Total Cache] CDN & ms-files.php url rewriting at admin

[Plugin: W3 Total Cache] CDN & ms-files.php url rewriting at admin

  • Hi,

    I was wondering if it’s intentional that at WP’s admin side, W3TC does not rewrite the image URL’s to point to CDN (AWS S3). Files get properly uploaded and at the public site they images show up properly (with rewritten URL’s pointing to CDN).

    We’re using WP multisite in a load balanced environment. As a result, if an admin page request hits a server that does not have a local copy of the file, the image seems to be broken in the editor. URLs are pointed to http://www.example.com/files/2012/10/image.png that in turn gets rewritten to to /wp-includes/ms-files.php?file=…

    In general I do not care even the URL’s would stay as they are, but in case that there is no local copy of the file, it would be good that it would be downloaded from the CDN to the server in question.

    Thanks,
    Ville

    http://wordpress.org/extend/plugins/w3-total-cache/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    I am wondering if I could contribute somehow and help solving the issue. Just went through the ms-files.php and it’s rather simple script, though there are no integration points to receive the file from CDN (S3 in our case).

    At line 26 the ms-files.php builds the file path:
    $file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET[ 'file' ] );

    Right after, there is a check if ( !is_file( $file ) ) { that matches if there is no local file on the server. This is the location where I should somehow check from the CDN if the file exists there.

    Does W3TC provide any API that I could use to convert the requested file name to a CDN url (to fetch the file and save it locally then)?

    Ville

    I think WordPress TOTALLY SUCKS in this regard.

    I’m also using Load Balanced install, and I happen to have my own CDN with image optimizations and stuff.

    I have 8 servers with my nginx proxy cache and 4 servers with apache+wordpress in two data centers using a central master-master database and I JUST NEED an option to link img src uploaded files with a different domain – HINT: using upload_url_path.

    This sucks and having to use a plugin to save the post with regex is totally lame when the option to use a different domain with $upload_url_path is already there.

    4 cents

    Plugin Author Frederick Townes

    @fredericktownes

    The latest version has much better MultiSite you could try that and see if issue remains.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: W3 Total Cache] CDN & ms-files.php url rewriting at admin’ is closed to new replies.