Hi all,
I am having a bit of trouble talking to my Chirpstack instance over ssl
At the moment, this chirpstack server is running on a linux (ubuntu) machine, along with a nginx instace handling the https.
and added configs for websocket endpoint:
location ~ ^/api/(gateways|devices)/(\w+)/(frames|events)$ {
http2_push_preload on;
proxy_pass http://localhost:8080/api/$1/$2/$3;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
location / {
proxy_pass http://localhost:8080/;
}
and I have no problem accessing the web interfaces of Chirpstack via HTTPS
However, when I try to get data out of chirpstack via the Python API, i am getting:
Received http2 header with status: 400
Code used:
server = “mydomain:443”
dev_eui = “xxxxxxxxxxx”
api_token = “xxxxxxxx”
ca = ‘CA.crt’
root_certs = open(ca).read().encode(‘utf-8’)
credentials = grpc.ssl_channel_credentials(root_certificates = root_certs)
channel =grpc.secure_channel(server, credentials)
Device-queue API client.
client = api.DeviceServiceStub(channel)
Define the API key meta-data.
auth_token = [(“authorization”, “Bearer %s” % api_token)]
Construct request.
req = api.EnqueueDeviceQueueItemRequest()
#req.queue_item.confirmed = False
#req.queue_item.data = bytes([0x01, 0x02, 0x03])
req.queue_item.dev_eui = dev_eui
#req.queue_item.f_port = 10
resp = client.Enqueue(req, metadata=auth_token)
Print the downlink id
print(resp)
Note I have used “grpc.secure_channel” in above code, if I swap it with “grpc.insecure_channel(server)” and connect to server port 8080 directly (bypassing Nginx), everything works fine.
Would the problem be with the NGINX?
many thanks