0

I am trying to access remote server by calling its API. remote server does not allow access when i try to access it using localhost

for example:

XMLHttpRequest cannot load https://backendpublic.development.intern.xyz.com:8443/Gateway/dropdownLibrary?filter=%7B%22librarytype%22:2,%22active%22:1%7D. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9002' is therefore not allowed access.

And this is required behaviour from remote server because of security concerns so i should be able to access it using DNS names.

And when i try to access it using my systems DNS name like:

ws1066.intern.xyz.com:9002/.... (ws1066 is my system's DNS name)

then browser do nothing and in console i get following :

GET

http://ws1066.intern.xyz.com:9002/mtpView;id=ng_6933net::ERR_CONNECTION_REFUSED

I am totally clueless about this problem.

Thanks.

lesnar
  • 2,400
  • 7
  • 41
  • 72
  • This is not an Angular issue. The headers of the server don't allow you to connect. Hence the "Access-Control-Allow-Origin" error. See http://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work – koningdavid Oct 20 '16 at 13:52
  • only in case of localhost but when i use DNS name ws1066 , i dont recieve enough information.it might not be directly related to angular but i am new to angular so just posted it with angular2 tag – lesnar Oct 20 '16 at 13:55
  • One thing I just noticed, if the first call where you get the Headers error, you are hitting port 8443, but when you are using the DNS name, you're hitting 9002. Are those differing ports setup to route correctly? – Dave V Oct 20 '16 at 13:59
  • In first request when i use localhost:9002 request is reaching remote server with port 8443 and then server declines the request .In second with DNS name i doubt if request is being sent. – lesnar Oct 20 '16 at 14:01

0 Answers0