Greetings,
I am facing same problem.
I am trying to communicate with ChirpStack server using Vuejs. When I send request i got CORS error:
const response = await axios.get(“http://xx.xx.xx.xx:8090/api/gateways?limit=10”, {
headers: {
‘Content-Type’:‘application/json’,
‘Accept’: “application/json”,
‘Grpc-Metadata-Authorization’: Bearer ${mytoken}
}
});
and getting below error
Access to XMLHttpRequest at ‘http://xx.xx.xx.xx:8090/api/gateways?limit=10’ from origin ‘http://localhost:5173’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
I am using chirpstack v4
I tried adding different variations of velow code to chirpstack.toml, chirpstack-gateway-bridge.toml and /etc/chirpstack-rest-api/environment (followed by corresponding service restart), but without success.
[api.cors]
allowed_origins=[“*”]
allowed_methods=[“GET”, “POST”, “PUT”, “DELETE”]
allowed_headers=[“Authorization”, “Grpc-Metadata-Authorization”, “Content-Type”]
expose_headers=[“Grpc-Metadata-Authorization”]
allow_credentials=true
Note that API itself is working fine if I try from Postman application.