1

I'm not sure this can be done nicely, but maybe someone has an idea.

Following is a mockup of my setup enter image description here

I have 2 sites (as in "datacenters") located miles apart. the "local" one, named "destination" and remote one named "source" on the sketch.

In my "local" site, I have 2 physical esxi servers, hosting a bunch of everything ( a lot more than what is pictured, only what is relevant is pictured)

In my "remote" site, I have 2 physical servers running CentOS 5 and they are too old for anything and too expensive to put a new server in, so I decided to migrate some of the resources there to my local site.

Both apache servers are hosting 1 wordpress multisite and some other php and non-php websites. And they are both behind an nginx server.

I have successfully migrated sourceA.com to detination as sourceA.com (DNS still points to the old site and nginx is proxy-ing to my "local" nginex, which is proxy-ing to apache

As is, this works as expected from the outside world.

The other websites and services on source also function ok.

My problem is that I'd like to do some maintenance on siteA, from my local LAN without going to source.com and getting proxied back...

I think it's a reasonable request :)

Now, I can setup either my local dnsmasq OR my PCs hosts file so that when accessing "siteA.com" from the webbrowser it will do what I want.

But now, I cannot access my email on siteA.com because the IP no longer hits the "source" server but hits my LAN apache or nginx server.

Same goes when ssh-ing to the other side.

(yes, I can try using one of the other domains and modify my scripts and everything, but I really don't want to get into modifing settings and scripts I've put in place ages ago. If it ain't broken, don't fix it. Those work fine, so I need something that doesn't potentially bust something up)

I tried to configure a local multisite alias for this domain (siteA). But because the multisite is configured with "default" alias on "siteA.com", the moment the browser hits WP with "siteA.local" it gets a 302 to "siteA.com" and goes to source server and gets proxied.

I guess the next step is to hack into WP and make it not redirect on local aliases, but then I'll have to do that change every time WP gets updated. I wasn't able to find a plugin that disables this or somehow allows custom filtering on what gets redirected.

Anyone having a better idea?

0

In the wordpress configuration there are two variables for setting the site URL.

Conventional wisdom dictates that the full URL is used for these values. However, on my single-site WordPress, I do not specify the scheme or the hostname. Which means that the site redirects using a relative URL (with a leading / but without scheme or hostname).

It may work with multi-site WordPress (I don't know), but it means that the site can be accessed using more than one domain name.

  • Thanks for the info. I tested your solution for my target MU instance, and it partially works. I then removed your suggestion and tried again and it still partially worked. So I did a bit of digging and noticed that somehow, the 302 redirect disappeared. The first GET from today was the one I tested and it was a 302, but all the subsequent ones returned 200. Now, when I say "partial" is because some stuff if still taken form the originating server, but that is due to content. Your suggestion, after googling it, lead me to stackoverflow.com/a/12959092/630515 – ciuly Oct 22 '16 at 12:13
  • I honestly don't know how or why the 302 went away after the first call, and only today. I will migrate another site one of these days and will keep an extra eye on this behavior. I will get back with my findings, but so far it seems your idea didn't have any impact on this redirect. Unless it made WP change something in the DB that I'm not noticing. – ciuly Oct 22 '16 at 12:16
  • just a friendly update: I still haven't gotten around to that 2nf migration yet. – ciuly Dec 2 '16 at 10:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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