I have a bit of a problem getting our server to know what domain was requested to get to the server.

The scenario is like this.

site1.tld, site2.tld, site3.tld and site4.tld are all pointing to the CDN. The CDN is set up to pull data from one server. Let's name it origin.tld.

Now the problem comes when a customer types site1.tld. That's what they see, which is a good thing. But on the server side, it sees the request as origin.tld because that's what the CDN requested from it.

I do not see headers that are passed by the CDN like X-FORWARDED-FOR where we can still capture origin information.

Basically, I will need the server to catch which domain the user actually requested from the server side without using Javascript and sending cookies to the server containing requested URL.

Is this possible or am I delusional on trying to get this info "server-side?

  • 1
    Can you let us know what CDN you're using? – dan Jul 30 '16 at 6:42
  • "But on the server side, it sees the request as site1.com ..." / "I will need the server to catch which domain the user actually requested" - isn't that site1.com (in this instance)? – MrWhite Jul 30 '16 at 8:28
  • 1
    We will be using multiple CDN in the future like CDNetworks or Cloudflare, but for now we are just using MaxCDN. Sorry, that was a typo. The server sees origin.com. So site1.com/index.html to a player is site1.com/index.html but from the server's point of view, it's a request for origin.com/index.html. I will edit the main question as well if it allows me so nobody else gets confused by the typo. – hashtagjet Jul 31 '16 at 3:38

What you see is obviously technically possible however to know what MaxCDN provides you exactly did you ask them? I really doubt however that it works like you said, even if I have no direct proof of it, because that would affect a lot of customers. If it does, your easy solution is to configure site1.tld to catch from site1.origin.tld, site2.tld from site2.origin.tld, etc... or any other equivalent scheme as you obviously have full control over your origin.tld and the configuration you are giving to your CDN provider.

BTW, you are not helping people helping you as you do not provide the true names involved.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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