How to quickly create a header modifying reverse proxy with mitmproxy

I’m currently in the process of testing some changes on OctoPrint involving its automatic user login via request headers, and for that needed to quickly set up a reverse proxy that would modify the headers of the requests going to the development server for some quick testing. Specifically, I wanted a quick CLI tool that would allow me to set up a reverse proxy listening on port 5555, forwarding to http://localhost:5000 while also setting the headers X-Remote-User to remote and X-Remote-Host to localhost:5555....

March 12, 2024 · 1 min

How to use Obsidian's Dataview plugin to visualize frontmatter

For every OctoPrint release I run through several update tests: I flash a specific OctoPi version, push it to a specific OctoPrint version, configure the release channel, then see if updating to the newest release (candidate) works fine. I use my testrig and its automation scripts for that and usually go through something between 5 and 10 separate scenarios. So far all of these scenarios were noted down as a Markdown table in my release checklist that these days I prepare in my Obsidian vault, including manually adjusting the testrig commands to match the scenario....

April 14, 2023 · 4 min

How to grep a log for multiline errors

I just found myself in the position to have to grep an OctoPrint log file for error log entries with attached Python stack traces. I wanted to not only get the starting line where the exception log output starts, but the full stack trace up until the next regular log line. The format of the lines in octoprint.log is a simple %(asctime)s - %(name)s - %(levelname)s - %(message)s, so a log with an error and attached exception looks like this:...

February 1, 2023 · 5 min
Mastodon