Invalid server URI in printer/classes pages in the web interface #3022

michaelrsweet opened this Issue Nov 25, 2008 · 14 comments


None yet
1 participant

michaelrsweet commented Nov 25, 2008

Version: 1.3.9 User: ppoilbarbe

When accessing to the "/printers" or "/classes" page via the web administration tool, the server address is systematically set to whatever was the address when accessing the page.
For example if you access: http://mycupsserver.domain.tld:631/printers you have all the defined printers but when you try to access the printer (clic on icon) or manipulate it (clic on buttons) there is an access error since we are not on the machine where the cups server is running.
The ServerName directive in cupsd.conf is set to mycupsserver.domùain.tld.
If we try whith the ip address, there is the same kind of result.
I have just upgraded the cupsd server to 1.3.9 (compiled from sources) and it was working in previous version (1.1)


michaelrsweet commented Nov 27, 2008 User: mike

Is mycupsserver.domain.tld mapped to, even as a secondary address?


michaelrsweet commented Dec 5, 2008 User: hebron

This is the same problem I had with version 1.3.9.
Version 1.3.8 works okay, though. See STR #3026.


michaelrsweet commented Dec 5, 2008 User: mike

Please attach the /etc/cups/cupsd.conf, /etc/hosts, /etc/resolv.conf, and /var/log/cups/error_log files from the affected system.


michaelrsweet commented Dec 8, 2008 User: ppoilbarbe

The ip address of the server (this is a master server of a cluster) has its own address on a line in the hosts file, with its fully qualified name as the first name.


michaelrsweet commented Dec 8, 2008 User: mike

What does the "hostname" command report?


michaelrsweet commented Dec 9, 2008 User: ppoilbarbe as expected/


michaelrsweet commented Dec 11, 2008 User: hebron

/etc/nsswitch.conf might also be of importance in this issue.
In my case the hosts line reads:

hosts: files nis

and so /etc/resolv.conf shouldn't matter. Our host name
lookups come from nis. But it appears that cups 1.3.9 is
ignoring nis lookups and is trying to do a DNS lookup.


michaelrsweet commented Dec 12, 2008 User: ppoilbarbe

We don't have nis on hosts line in nsswitch.conf, just:

hosts: files dns


michaelrsweet commented Dec 15, 2008 User: hebron

Please attach the /etc/cups/cupsd.conf, /etc/hosts,
/etc/resolv.conf, and /var/log/cups/error_log files from the
affected system.

I've posted these files from my system
(conf_and_log_files2.tar.bz2). The system is CentOS Linux 5.2
running on x86_64. I did a fresh build of cups 1.3.9 and
configured it as indicated in the posted files.

The problem happens when accessing the CUPS web interface from
another machine which is not running CUPS. If I go to the
"printers" tab and then hover the cursor over any of the printer
modification buttons, such as "Modify Printer" or "Set Printer
Options", the status bar of the browser shows:

This link doesn't work, of course, because my local machine is
not running cups and doesn't have port 631 active.

Best regards,



michaelrsweet commented Dec 16, 2008 User: ppoilbarbe

Yes I did forget to say this, the computer running the web browser does not have a cups server running (on one has it).


michaelrsweet commented Jan 9, 2009 User: mike

Try the attached patch - it basically adds the raw IP addresses to the list of "local" server addresses.


michaelrsweet commented Jan 12, 2009 User: ppoilbarbe

It works. Thanks.


michaelrsweet commented Jan 12, 2009 User: mike

Fixed in Subversion repository.


michaelrsweet commented Jan 12, 2009


Index: cgi-bin/ipp-var.c

--- cgi-bin/ipp-var.c (revision 8214)
+++ cgi-bin/ipp-var.c (working copy)
@@ -778,7 +778,7 @@
int urlsize, /* I - Size of URL buffer /
const char *newresource) /
I - Replacement resource */

  • char method[HTTP_MAX_URI],

  • char scheme[HTTP_MAX_URI],
    @@ -825,13 +825,13 @@

  • Convert the URI to a URL...

  • httpSeparateURI(HTTP_URI_CODING_ALL, uri, method, sizeof(method), userpass,

  • httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass,
    sizeof(userpass), hostname, sizeof(hostname), &port,
    rawresource, sizeof(rawresource));

  • if (!strcmp(method, "ipp") ||

  •  !strcmp(method, "http") ||
  •  !strcmp(method, "https"))
  • if (!strcmp(scheme, "ipp") ||

  •  !strcmp(scheme, "http") ||
  •  !strcmp(scheme, "https"))

    if (newresource)
    @@ -870,7 +870,9 @@

    • Map local access to a local URI...
  • if (!strcasecmp(hostname, "localhost") ||

  • if (!strcasecmp(hostname, "") ||

  • !strcasecmp(hostname, "[::1]") ||

  • !strcasecmp(hostname, "localhost") ||
    !strncasecmp(hostname, "localhost.", 10) ||
    !strcasecmp(hostname, server) ||
    !strcasecmp(hostname, servername))

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment