CORS error while creating session through javascript (web.origin Configuration)

yashbhat7 years ago

While going through the code, I found something called web.origin that has to be set in the configuration file - https://github.com/tananaev/traccar/search?utf8=%E2%9C%93&q=web.origin&type=
However that isn't mentioned here on the configuration file page.
https://www.traccar.org/configuration-file/
I'm posting this in order to help others facing the same problem as me.
Also just confirming do I have to set
<entry key='web.origin'>*</entry>
in order to allow all?

Anton Tananaev7 years ago

Yes, that's correct.

eric_xl2 years ago

I want api response only when calling from one of my domains, tested web.origin in traccar.xml with no luck (restarted, service and os).
compiled server with intellij and at least response header changed to the configured domain (edited corsResponseFilter.java) in line 39:

    private static final String ORIGIN_ALL = "http://myserverdomain.com";

I've configured apache to redirect web interface to a secure connection, and everything is working ok;
But still responding to any domain, could you help me how to achieve that ?
PS: traccar 5.4 Rocky 8, apache.

Aegis Solutionsa year ago

Dear friend, how are you?

Im displaying the following error in browser console:

192.168.1.5:8082/api/positions' from origin 'http://xxx.xxx.xxx.xxx' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `private`.

Can you kindly explain me how did you manage to get that configuration?

Im trying to solve this and i canĀ“t find anything information on internet,

I would be very thankful for your help.