0

I'm trying to make a post request to firebase via my vue app and i keep getting this error image

I'm running a webpack server and the website is on localhost:8080 however I also have a live version hosted on hostinger this is the site http://arestate.online/ and when I click on add new blog, after filling out the details and clicking post it throws the CORS error too.

I've added and modified a .htaccess file to include this IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" /IfModule> (with the tags closed properly, I just modified them so they would show up on stack overflow)

IF anyone could offer me assistance that would be superb!

AnonymousSB
  • 3,516
  • 10
  • 28

2 Answers2

0

You have to define which methods can be used by the remote origin with the 'Access-Control-Allow-Methods' header, example:

Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST

See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Mr. bug
  • 366
  • 2
  • 11
0

I think is better if you use the firebase Lib from npm. REST API of firebase Database is extrem ineficcent because it downloads many unuseful data and you need to keep in mind that firebase bills the amount of downloaded data. But you don't specify which module you are using. It would be also great if you post the code.

Helmer Barcos
  • 1,898
  • 12
  • 18