Display your 3D printer's progress, temperatures, and status in OBS using Klipper/Moonraker/Mainsail.
You need to allow cross-origin requests so OBS can fetch data from your printer.
SSH into your printer and edit the Moonraker config:
nano ~/printer_data/config/moonraker.conf
Find the [authorization] section and add the appropriate CORS domains.
If loading the HTML file directly in OBS (file:// protocol):
Add null to allow local file access:
[authorization]
cors_domains:
*.lan
*.local
*://localhost
*://localhost:*
*://my.mainsail.xyz
*://app.fluidd.xyz
null
If hosting on a web server:
Add your web server's URL:
cors_domains:
*.lan
*.local
*://localhost
*://localhost:*
*://my.mainsail.xyz
*://app.fluidd.xyz
http://192.168.1.100
http://192.168.1.100:*
Replace http://192.168.1.100 with your web server's IP.
Always add your printer's IP address to CORS domains:
cors_domains:
*.lan
*.local
*://localhost
*://localhost:*
*://my.mainsail.xyz
*://app.fluidd.xyz
http://192.168.1.50
http://192.168.1.50:*
null
Replace 192.168.1.50 with your printer's actual IP address (the same one you use in PRINTER_IP config).
Save the file and restart Moonraker:
sudo systemctl restart moonraker
Download the HTML file and open it in a text editor. At the top of the file (around line 55-57), you'll find the configuration section:
// CONFIGURATION
const PRINTER_IP = '192.168.1.100'; // Your printer's IP address
const PRINTER_NAME = 'My Printer'; // Display name for your printer
const UPDATE_INTERVAL = 2000; // Update frequency in milliseconds (2000 = 2 seconds)
Update these values:
- PRINTER_IP: Your printer's IP address (e.g.,
192.168.1.50,192.168.0.200, etc.) - PRINTER_NAME: The name you want displayed (e.g.,
Prusa MK3S,Voron 2.4,Ender 3, etc.) - UPDATE_INTERVAL: How often to poll the printer (2000ms = 2 seconds is recommended)
Save the file.
Option A: Load HTML file directly (Easiest)
- Save the HTML file to your computer
- Open OBS Studio
- Add a new Browser Source to your scene
- Enter the full file path to your HTML file (e.g.,
file:///C:/Users/yourname/klipper-obs-overlay.html)- OBS will show this in the URL field automatically
- Set the dimensions:
- Width:
450 - Height:
280
- Width:
- Check these options:
- ☑ "Shutdown source when not visible" (saves resources)
- ☑ "Refresh browser when scene becomes active" (optional)
- Click OK
Option B: Host on a web server
- Host the HTML file on a web server (your printer, a NAS, or any web server on your network)
- Open OBS Studio
- Add a new Browser Source to your scene
- Enter the URL to your HTML file (e.g.,
http://192.168.1.100/klipper-obs-overlay.html) - Set the dimensions as above
- Make sure you added your web server's URL to CORS domains (see Step 1)
- Click OK
Position and resize the overlay wherever you want on your stream!
- Printer Name: Your custom printer name
- Status: Current state (Printing, Paused, Idle, etc.)
- Progress Bar: Visual progress with percentage
- Time Remaining: Estimated time left in the print
- Filename: Current file being printed
- Hotend Temperature: Current/Target (e.g., 210°C / 215°C)
- Bed Temperature: Current/Target (e.g., 60°C / 60°C)
You can customize the appearance by editing the CSS in the <style> section:
- Change colors in the progress bar gradient
- Adjust font sizes and families
- Modify the background transparency
- Change border radius and padding
"Connection Error" displayed:
- Verify your printer IP/hostname is correct
- Make sure you can access
http://your-printer-ipin a web browser - Check that Moonraker is running:
systemctl status moonraker
CORS errors in browser console:
- If using
file://(Option A): Addnulltocors_domainsin moonraker.conf - If using web server (Option B): Add your web server's URL to
cors_domains - Always add your printer's IP address to
cors_domains - Restart Moonraker after making changes
- Make sure there are no typos in the config file
Temperatures showing as "--":
- This is normal when the printer is idle/not printing
- Temperatures will appear once a print starts or heaters are manually set
To display multiple printers, create separate HTML files for each printer with different PRINTER_IP and PRINTER_NAME values, then add each as a separate Browser Source in OBS.