Reputation: 71
I have a little problem with CUPS 2.2.7
This is my /etc/hosts file:
127.0.0.1 example.com
127.0.0.1 localhost
in http://localhost:631/ CUPS is working right
but in http://example.com:631/ it doesn't work on the same pc.
The message error in View error log is that one:
E [21/Feb/2019:11:54:18 +0100] [Client 33] Request from "localhost" using invalid Host: field "example.com:631".
The web page on Firefox print an error message Invalid request and give me an Error (error code: 400) but seems point on CUPS.
How to solve this problem so that example.com:631 points to localhost and CUPS answers it successfully instead of Error 400: Access Denied.
Upvotes: 5
Views: 20888
Reputation: 141493
By default cups responds only to HTTP requests with HTTP Host header equal to "localhost". To allow it servicing requests with different HTTP host headers use ServerAlias
directive as described in the man cupsd.conf documentation. It's common to do the most unsafe thing and add
ServerAlias *
to /etc/cupsd.conf
to allow all possible HTTP host headers to be serviced.
Upvotes: 24
Reputation: 372
I know this is old, but I too was experiencing the same issue recently and I resolved it by updating the following line in cupsd.conf
from:
Listen 0.0.0.0:631
changed to:
Listen *:631
For those that maybe care to know, I'm running CUPS within a docker container, and this change corrects the "Bad Request" response.
Upvotes: 8