CORS Missing Allow Origin in chirpstack V4

Hi,
I have upgraded chirpstack v3 to v4. In v3 together with thingsboard it worked fine, but with v4 I have CORS problems (CORS Missing Allow Origin) when making a post request (/api/devices/{queueItem.devEui}/queue) .

V3 chirpstack-application-server.toml:
[application_server.external_api]
cors_allow_origin=“*”

V4 /etc/chirpstack-rest-api/environment:
INSECURE=true
CORS=“*”

How can i fix this?

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.

Greetings, any help here? I would really appreciate if someone can give directions. Thanks

We have same problem, we apply --cors “*” parameter at compose file as below, nothing changed.

services:
chirpstack:
image: chirpstack/chirpstack:4.3
command: -c /etc/chirpstack
restart: unless-stopped
volumes:
- ./configuration/chirpstack:/etc/chirpstack
- ./lorawan-devices:/opt/lorawan-devices
depends_on:
- mosquitto
- redis
environment:
- MQTT_BROKER_HOST=chirpstack-docker-mosquitto-1
- REDIS_HOST=redis
- POSTGRESQL_HOST=host.docker.internal
ports:
- 8081:8080
extra_hosts:
- “host.docker.internal:host-gateway”

chirpstack-gateway-bridge-eu868:
image: chirpstack/chirpstack-gateway-bridge:4
restart: unless-stopped
ports:
- 1700:1700/udp
volumes:
- ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
depends_on:
- mosquitto

chirpstack-rest-api:
image: chirpstack/chirpstack-rest-api:4.3
restart: unless-stopped
command: --server chirpstack:8080 --bind 0.0.0.0:8090 --insecure –cors “*”
ports:
- 8090:8090
depends_on:
- chirpstack

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.