5

I have InfluxDB running on localhost:8086(it's default) and a go program running on a different port (as it has to, can't also run on 8086). I am trying to post data to InfluxDB using JavaScript in my go program, and I get No Access-Control-Allow-Origin response. This github issue (posted by someone using a reverse proxy) says that the problem can be gotten around by configuring a proxy mechanism, but I am not using one. Is there a way to post data to InfluxDB without getting that response? Receiving data via post requests seems like a core function of InfluxDB, but it is not working correctly.

BrainLikeADullPencil
  • 11,313
  • 24
  • 78
  • 134
  • In your `POST` to InfluxDB, are you using the URL? Have you tried with the IP address, as indicated in the github link you posted? It might be the easiest workaround. Later in that same thread there was this link to [issue #1268](https://github.com/influxdb/influxdb/issues/1268), which might be what you're looking for. – Eric Lease Apr 17 '15 at 04:54

1 Answers1

-3

If it's based on Apache you just have to allow your site B to access your site A (and it's set by site A) : How does Access-Control-Allow-Origin header work?. A simple htaccess can do the job :

Header set Access-Control-Allow-Origin: http://localhost

(If it's localhost that access the site A)

Community
  • 1
  • 1
Pierre Granger
  • 1,993
  • 2
  • 15
  • 21
  • Are you familiar with InfluxDB? I don't see an option to configure this. It seems like your answer speaks to the general problem, without addressing the InfluxDB issue. – BrainLikeADullPencil Apr 07 '15 at 14:44
  • Absolutly not, but it's (IMO) not a problem in InfluxDB : it's a communication problem from a site B who want to access a ressource in javascript from a site A : in that case, site A has to say "okay, i allow site B to access my services", wich is exactly the usage of "Access-Control-Allow-Origin". You must find a .htaccess on influxDB, if it's Apache based. But don't look too much on "InfluxDB", it's not "his" problem. – Pierre Granger Apr 07 '15 at 14:49
  • 1
    My point was, does InfluxDB let its users configure that option. (I also don't think it's Apache based). Also, InfluxDB is not a website, it's something you install on your computer, and it should let users configure those options. – BrainLikeADullPencil Apr 07 '15 at 15:54
  • Yeah if it's not apache based it's gonna be much more complicated :( you have to send an http header with Access-Control-Allow-Origin, but there i don't know how can you do it on influxDB, sorry :( – Pierre Granger Apr 07 '15 at 16:01