Sunday, November 21, 2010

CUPS "400 Bad Request" Problem - And its Simple Solution

Recently I wondered why the CUPS client machines in my network, all with a client only setup, could not print.
I finally found out that the CUPS webfrontend on port 631 was only reachable when called as "http://print:631/", with "", there was only a "400 Bad Request" error.
So as a first solution I configured the client to print on "print", not on "", but that was of course still an issue that needed investigation.
Long story short: I had this line in /etc/hosts: server proxy print ntp

(I'm running dnsmasq on this machine to serve the internal network with DNS and DHCP, so those multiple hostnames are for the different functions of the machine).
Adding "" to this line and restarting cupsd solved those issues.
No idea why CUPS looks into /etc/hosts (or if it is some libc function that does this), but maybe this post helps somebody else with this problem.