Hex generation error when using https on a local server

Hello! I installed the latest version of Microbit on a local Ubuntu server, and everything is up and running. I installed nginx and enabled HTTPS certificates. I started the local server with the command “pxt serve --port 3232 --wsport 4233 --hostname pxt.edu --local --https.” The interface loads and all functions work, except for generating the hex file. It says “no internet access,” and “connect to the internet and try again.” When using an IP address to log in to Microbit, the hex file is generated without problems, but the webbusb function is missing. I can’t figure out where the problem is; I’ve already tweaked both the nginx and Microbit rules configurations. I’m asking the community for help on how to resolve this issue.

1 Like

welcome @andrey1

1 Like

um what……is……that….mean?

1 Like

Hello!
When I run the micro:bit by IP address and click “Save,” a dialog appears to save the .hex file to my computer. But when I access the micro:bit via its domain name, the .hex file is not created (I attach the administrator console output). I’ve been trying to integrate this into the teaching process for three months and don’t understand where I went wrong or which direction to take next.
Thank you for your help!!

the local server is not meant to be used a publicly facing server; it’s meant for local development only.

can i ask why you’re trying to host your own website instead of just using makecode.microbit.org?

I want to set up mobile stations consisting of one laptop (local server), a router, a set of tablets, and micro:bit boards so we can work anywhere without relying on power or the Internet.

Currently the minimal functionality is available via the local IP, but WEBUSB does not work — you can’t upload a program to the micro:bit “on the fly.” I configured nginx (previously tried Apache), installed HTTPS certificates, and set up WebUSB (connection to the micro:bit board), but .hex files stopped being generated. I’ve already reviewed a lot of documentation and made many edits to JSON files, but I haven’t been able to solve the problem yet.

@andrey1 we publish an offline app for just this scenario:

that being said, there is always some functionality that is not available when offline. while programs are compiled locally in the browser, C++ files from extensions are compiled using our cloud compiler. we cache these compiled extensions locally once they’ve been fetched from the cloud compiler, but you have to hit the internet once to fetch them.

one of the benefits of the offline app is that it comes packaged with all of the built-in extensions pre compiled so that it is much less likely to ever require an internet connection. still, if you’re using a third party extension that has a lot of C++, you’ll still need an internet connection at least once to get the compiled hex file.

Thank you for your reply, Richard! You have a great offline app, but as I mentioned earlier, I want to use it on tablets running Android; your offline app is only for laptops. Is there an offline app available for Android OS?
May I return to the original question: am I correct that the service cannot be run over HTTPS? I need minimal functionality — it works by IP, so in theory somewhere in the configuration files you need to specify a DNS name instead of using an IP address?

i see, in that case, i still don’t recommend using pxt serve here. instead, use pxt staticpkg to generate a static version of the site and serve that using the server of your choice. more docs here:

let me know if you run into issues!