-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolved domain name is used as Host in Octoprint upload request breaking reverse proxies (Windows only probably) #9734
Comments
Thanks for the report. Could you please test it with 2.6.0-alpha3? There have been changes since 2.5.0 which may have solved it or changed the behavior. |
Is your OctoPrint resolved using Bonjour (nodns) service? The issue we are facing is that the zerodns resolve in Windows is not working reliably. I don't remember all the details, but I believe
We are looking for the options to solve your issues. |
Nope. No Bonjour. Good old DNS. I run a DNS server on that machine that resolves *.lan domains to 192.168.0.3 where the reverse proxy is taking care of the rest. The only issue I see with what you wrote is maybe the second option but only if you just treat every tld that is not official as being Bonjour. There's nothing on that server that uses Bonjour. If you actually check for Bonjour services, there is no way anything can resolve to the IP of that machine. |
Hello, we have an idea what is causing the problem. Luckily there is an inner variable, that might help. Please follow these steps:
Please let us know if it helps as we still would have to find a way to fix this without the variable. |
That actually worked! Thank you very much! |
Yeah the solution worked flawlessly. Was I supposed to close this issue? I wasn't sure so I left this open. |
@ro-kue Nice. Closing as solved. See you |
@ro-kue We added changes that should help your issue. Would you try PrusaSlicer-2.6.0-beta3 without the allow_ip_resolve=0 option? The changes should be setting "Host" in HTTP headers to correct value. |
Sorry for the delay (my son was born on the 19th of May, didn't get to do any 3D printing until now. And I also missed the GitHub email...). It seems to work now with 2.6 just fine. However, some time in March I actually switched from having a DNS server in the basement with a not official tld to an actual domain and https. So my setup isn't the same anymore. I don't see how this would cause problems though. |
Description of the bug
Background
I am 95% sure that this is a bug with PrusaSlicer and not a configuration problem on my end although I might be unaware of some Windows specific issues with DNS that cause this but I think this is unlikely too.
I have two printers both with their own OctoPrint instance that are running on the same machine (with Docker but that's irrelevant) in front of them is an Nginx server configured as a reverse proxy that is routing requests via *.lan domains. This is not really relevant to the bug but it explains why this is literally breaking reverse proxies.
Problem
I can add those instances without issues to a physical printer and PrusaSlicer will say that everything is fine. The API key works, all is good.
Once I slice something and try to upload it to OctoPrint, I just get an error that says "Error uploading to print host: HTTP 401: Unauthorized".
That is nonsense. I am authorized. I tried the global API key, I tried the user API key, I created an Application Key, the user has all permissions it could possibly have. There is no way in hell I am not authorized.
However, this does NOT happen on my work Mac which is why I'm so sure it's a PrusaSlicer issue. There everything works as expected.
Log files for OctoPrint are empty which threw me off for months because I was sure it's an OctoPrint issue. But this makes perfect sense once I explained it.
Explanation
Somewhere during the whole thing PrusaSlicer is trying to resolve the domain. It does that and sends the HTTP request for uploading the gcode. However, it is also setting the Host field in the HTTP header to the IP it resolved the domain to.
In my case, the Host header should be "drucki.lan" because that's where the instance is hosted and that's what the reverse proxy is looking for. This is also what a browser does and this is what PrusaSlicer does when it tries to verify the API key.
However, when uploading gcode, the Host header contains 192.168.0.3 which is the correct IP for my home server but doesn't hit octoprint because my reverse proxy doesn't really know what to do with this. I'm actually not sure where the error is actually coming from but that's an issue with my setup and not PrusaSlicer. It literally can't be OctoPrint though.
Screenshots
Here's the error that I'm getting.
Here's my physical printer config
Here's the Wireshark capture of the version check PrusaSlicer does that shows that the Host header is set to drucki.lan which is correct and how it should be.
Here's the Wireshark capture of the upload that clearly shows that the Host header is set to 192.168.0.3 which is the correct IP but should not be set in the Host header if I don't set it in my configs.
Here's the screenshot that shows that PrusaSlicer is pretty happy with the config in the config screen.
Here's a screenshot of a Wireshark capture on macOS showing that it's at least not happening on macOS (so probably a Windows problem). It's talking to the same OctoPrint instance. There is generally a lot more going on because the sliced model is larger.
Project file & How to reproduce
dns_resolve_bug.zip
As requested, project file is included.
One way to maybe reproduce this locally (haven't tested it but might make it easier for you):
Checklist of files included above
Version of PrusaSlicer
2.5.0+win64
Operating system
Windows 11 Home 22H2 Build 22621.1105 Installed on 2022-01-17 (so pretty fresh)
Printer model
Prusa Mini but happens with an Ender 5 too
The text was updated successfully, but these errors were encountered: