While implementing barcode scanning using QuaggaJS, I realized that I have to have a secure origin in order for the live scanning feature to work on mobile devices. Exactly, as written in QuaggaJS README file:
The simplest thing to do for the development environment is to generate a self-signed certificate.
Generating self-signed certificate
Only one command is needed:
The command will prompt for the information to include in the certificate request. You can fill them as you wish,
Common Name (eg, fully qualified host name) is required to generate the certificate.
The following should be in the nginx config:
Check the path for
ssl_certificate_key in your configuration.
The suggested path works if the certificates directory is mounted to
/etc/nginx/ssl as described below in
In order for the certificate to work, add the following volume (assuming
domain.key are located in
certs directory at the root of the project) to the nginx container:
And don’t forget to change the port: