Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have just managed to get my site running behind a Cloudfront distribution using the custom distribution API, but now i cannot login to the site using the standard old address (since i screwed around with DNS). The way i have it hooked up is as follows:

backendblog - real server blog - cloud front distribution told to get data from backendblog

visiting blog results in the page being returned (and quite fast too!) but none of the dynamic stuff (search, login, etc) work. comments work grand since they are managed by Disqus.

So, i have 2 questions around this:

1: how do i set it so that backendblog will allow me to login without redirecting to blog (if i set the config, it changes all the URLs... want the URLs to be what ever site the page loads on...) 2: how do i configure pages to have higher expire times so they stay in CloudFront longer?

Any ever try this?

the site, for reference, is blog.lotas-smartman.net (clodfront) or backendblog.lotas-smartman.net (dedicated box in Germany). have seen Pingdom avg response times drop massively in the last week with cloudfront...

share|improve this question
    
Have you tried the WP_SITEURL option in wp-config.php? –  AutoBlogged Apr 8 '11 at 3:29
    
looking at my wp-config, there is no mention of WP_SITEURL. seems that, looking at stuff online, that WP_CONFIG is the opposite of what i want to do... i would like multiple domains pointing to one WP instance, and each of them to use the domain they came from... –  TiernanO Apr 8 '11 at 7:58
add comment

2 Answers

I've been working on this exact same issue. What you need to do is have two domains. One for your backendblog and one that pointing at cloudfront. Your backendblog will be configured to serve up as itself (backendblog). In my test example I'm using my blog (http://blog.andrewshell.org) as the backendblog. If this was for production use you would probably have content.example.com as backendblog and www.example.com as cloudfront. Then you setup cloudfront to pull from backendblog (you got this part figured out already) in my example the cloudfront url is http://d11b8ym2xu437t.cloudfront.net.

The tricky part is to write a plugin that rewrites all your urls from backendblog to the cloudfront url when it's getting a request with the cloudfront user agent (see http://pastebin.com/GUybEtHd). When you want to edit posts and such just log into backendblog, it shouldn't redirect because it's configured as backendblog (not the cloudfront url) yet all requests from cloudfront will be corrected so links stay on the CDN domain.

This isn't perfect, if you look in the source of my cloudfront url you will see a few references to my backendblog, but this is the line of thinking you'll want to go down. The next step is probably changing the plugin to capture all output in an output buffer and do a str_replace on it before returning it.

share|improve this answer
add comment

You mentioned that you want your urls changed to be what ever site the page loads on.

Maybe you could hook into pre_option_siteurl and pre_option_home and dynamically return the url you come from.

http://codex.wordpress.org/Plugin_API/Filter_Reference/pre_option_(option_name)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.