Community discussions

MikroTik App
 
fabracht
just joined
Topic Author
Posts: 1
Joined: Thu Dec 09, 2021 9:37 pm

HTTP GET 404 : HTTPS GET authority and subject key identifier mismatch for REST API

Thu Dec 09, 2021 9:44 pm

I'm having problems accessing the mikrotik router REST API on v7.1 stable.
I wrote a simple nodejs program to fetch data from the router:
```
import axios from "axios";

const grabRobotName = () => {
let user = "admin";
let password = "";

let encodedCredentials = Buffer.from(`${user}:${password}`).toString("base64");
console.log(`${encodedCredentials}`);

var config = {
method: 'get',
url: 'http://192.168.1.254/rest',
headers: {
'Authorization': `Basic ${encodedCredentials}`
}
};
axios(config).then(result => console.log(result)).catch(ex => console.log(ex.message));

}

grabRobotName();
```
If I use the https route on port 8443, I get
```
authority and subject key identifier mismatch
```
If I run on http on port 80, I get a 404 not found.
I would rather use the http connection to avoid the complications of getting a valid ssl certificate. There is no domain name for the ip endpoint, so it's pretty hard to get a valid signed certificate for that.
How can I access the rest API on http? Why am I getting the 404?
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3423
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: HTTP GET 404 : HTTPS GET authority and subject key identifier mismatch for REST API

Fri Dec 10, 2021 4:22 pm

I don't think that possible, pretty sure it only HTTPS via whatever port the IP>Services has assigned for HTTPS.

They do support Let's Encrypt in V7, and IP>Cloud>DDNS, but that only helps if your router can get port 80 traffic from internet. While theoretically you can do this temporarily, you'd still have make sure Let's Encrypt revalidates it every 90 days – which entails arrange internet access every so often for it renew the SSL.

You can purchase an SSL cert for a public domain name host, then internally make sure that resolves to the same name. Or your company uses MS Active Directory, there are ways generate certs from Windows Server that apply organizationally wide (and similar for other directories). These have longer expirations and don't require internet access.

Who is online

Users browsing this forum: No registered users and 17 guests