Luci web interface issue

I navigate to http://192.168.1.1 expecting the Luci login screen. Instead, the browser downloads a file named, 'luci' and here are the contents of the file:

#!/usr/bin/env ucode

'use strict';

import { stdin, stdout } from 'fs';

import dispatch from 'luci.dispatcher';
import request from 'luci.http';

const input_bufsize = 4096;
let input_available = +getenv('CONTENT_LENGTH') || 0;

function read(len) {
	if (input_available == 0) {
		stdin.close();

		return null;
	}

	let chunk = stdin.read(min(input_available, len ?? input_bufsize, input_bufsize));

	if (chunk == null) {
		input_available = 0;
		stdin.close();
	}
	else {
		input_available -= length(chunk);
	}

	return chunk;
}

function write(data) {
	return stdout.write(data);
}

let req = request(getenv(), read, write);

dispatch(req);

req.close();

What can I do to address this?

question is, what did you do, or did it happen out of the blue ?

2 Likes

I'm sure that's it. I just powered it on this morning. It was working fine last night. But... yesterday I did a sysupgrade using a snapshot image with NSS support. But, Luci was working just fine. But after powering it completely off last night and powering it on this morning, this happens. I know this is a UcLua script that it's downloading but I don't know why it's happening now.

Odd workaround to the problem was trying https://192.168.1.1 and ignoring the warnings about no certificate. The Luci interface came up.

you already did that ?

or was it HTTP <> HTTPS ?

I'm just guessing and trying stuff. When I go to http://192.168.1.1 it won't give me the Luci login screen, it instead downloads a file as I posted. I tried https://192.168.1.1 and I got the certificate warning, ignored it, and it brought up the luci login as normal, but in the browser, the https part is red and lined out and "Not Secure" so it's not an https connection. I got no explanation for this behaviour.

This is normal when connecting to LuCI via HTTPS. The browser doesn't trust the OpenWrt's cert because it's a self-signed certificate created when the router booted on first install. There's a few threads on this. It is HTTPS, but the browser has no method of verifying the self-signed certificate (which is expected behavior for any locally created certificate that has no public chain of trust).

Hope this helps.

No explanation for why I can’t get the Luci login screen when I type http but I can when I type https.

1 Like

Personally, I've experienced that when [accidentially] changing settings on the browser.

Since you noted that you did nothing to cause that in HTTP, I'm unsure. Apologies.

Did you keep settings upon doing the sysupgrade last night?

I’m going to start from scratch again. My setup has simple needs. I need to simplify it. I’ve added too many complications and now I can’t keep track or undo my own errors. I didn’t change any browser settings.