-1

I'm running Apache Tomcat on Windows Server 2012. All I did was download the zip file, open it on the desktop and i start/stop everything from there.

I'm trying to access some web services running on the server from a javascript program running on my dev machine. My dev machine and the server running apache are not on the same network and i am getting the following error:

XMLHttpRequest cannot load service-call-snipped-for-brevity 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:8080' is 
therefore not allowed access.

I've read that i have to add:

 Header set Access-Control-Allow-Origin "*"

to the httpd.conf file and I create it in the apache install conf dir (remember apache was "installed" by my unzipping the downloaded zip file to my desktop) and if it doesn't exist I can create it.

Excellent!

Except when I do all that and restart Apache Tomcat I still get the same error.

What am I missing?

f_puras
  • 2,521
  • 4
  • 33
  • 38
Mark Juszczec
  • 85
  • 1
  • 2
  • 7

1 Answers1

0

Apache Tomcat does not use a httpd.conf, Apache Webserver does.

There are plenty of answers that tell you how to configure Tomcat for CORS, for example How to enable CORS in apache tomcat

Community
  • 1
  • 1
Marged
  • 10,577
  • 10
  • 57
  • 99