2

I have a two-node NLB setup where I need to call several web services from client-side via ajax POSTs. If I hit the page at say:

http://clusternode1/ 

no issues.

If I hit it at

http://clusternode2/ 

no issues.

However, if I hit it at

http//clustername/ 

I get the cross-origin exception (as expected).

Is there anyway around this? Any way to reconcile which name the request is being made from to avoid the cross-domain exception?

Many thanks.

Andy Thornton
  • 628
  • 5
  • 11

1 Answers1

1

Few things off the top of my head; This depends on a couple of factors and there are a few approaches which you might tackle the issue:

(1) depending on your setup, why not just aim at the load balancer (usually this is the way things would be configured with the NAT), then let the loadbalancer do the work?

(2) If the nodes are on different domains you'll have to either look at provisioning for CORS

(3) If you don't have access to mess with headers etc you can look to proxy this but this semi defeats the purpose of load balancing

(4) perhaps setting cname aliases for each node will avert the crossdomain issues?

Hmm sure there's a solution in there somewhere :-)

Alex
  • 3,732
  • 5
  • 37
  • 59
  • ah yeah.. also it might be a concurrent session problem if you are using session dat in your ajax communication? – Alex Aug 27 '12 at 23:32
  • 1
    this also might be worth looking at: http://www.digital-web.com/articles/client_side_load_balancing/ – Alex Aug 27 '12 at 23:33
  • Thanks a lot for your reply. Apparently I don't understand NLBs very well. I hade my ajax posts for each page pointing at the URL for their respective machine (seemed to make sense to me). I changed both to just point at the NLB name (like you mentioned) and it sorted everything out. Guess that is its job. :-) – Andy Thornton Aug 28 '12 at 13:59