So after hitting my head in the wall on this issue also on and off for quite some time and i finally by accident figured out that even though my pos printer support https it does not in fact support it for printing, only the web interface for management for some strange reason... so i made a small proxy script to downgrade https to http...
make a directory of your choice then...
Commands:
-npm install express http-proxy-middleware https
-openssl req -nodes -new -x509 -keyout server.key -out server.cert
-nano proxyServer.js (and copy/paste and edit from below)
const fs = require('fs');
const https = require('https');
const express = require('express');
const { createProxyMiddleware, responseInterceptor } = require('http-proxy-middleware');
const app = express();
// Configuration variable for the target host
const TARGET_HOST = 'http:xxx'; // Replace with your target host
// Proxy middleware options with response handling
const options = {
target: TARGET_HOST,
changeOrigin: true,
selfHandleResponse: true, // The proxy will manage the response
onProxyRes: responseInterceptor(async (responseBuffer, proxyRes, req, res) => {
// Modify or translate the response from the printer here
// For example, you can change headers, status code, or the response body
const response = responseBuffer.toString('utf8'); // Assuming the response is a string
// Perform necessary modifications to the response
return response;
})
};
// Use the proxy middleware
app.use('/', createProxyMiddleware(options));
// HTTPS server with self-signed certificate
https.createServer({
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.cert')
}, app).listen(443, () => {
console.log('Listening on port 443 (HTTPS)');
});
then run:
node proxyServer.js
update for reference:
made a python minimalistic version also
https://github.com/kimasplund/minimal-proxy
works on my TM-T88V with UB-R04 wifi interface board...