ppelleti
Posts: 5
Joined: Sun Jun 11, 2017 11:00 pm

Accessing the Pi's CUPS web interface from another computer

Sat Jun 24, 2017 3:55 pm

I've installed CUPS on my Raspberry Pi 3, and I would like to access the CUPS web interface to configure my printer. My Pi is headless, so I'd like to do this from another computer.

When I go to http://pi3.lan:631/ it simply says "Bad Request". I followed the instructions here to make the web interface accessible remotely. However, it didn't work; I still just get "Bad Request".

The relevant portion of my cupsd.conf looks like this now:

Code: Select all

<Location />
  # Allow remote access...                                                      
  Order allow,deny
  Allow @local
</Location>
<Location /admin>
  Order allow,deny
  Allow @local
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow @local
</Location>
Any idea what I need to do to get remote access to the web interface?

As a workaround, I'm doing "ssh pi@pi3.local -L 8080:localhost:631" and then going to http://localhost:8080/ and this mostly works, but it's not great because apparently the CUPS web interface sometimes uses absolute URLs, and throws me back to http://localhost:631/ instead of http://localhost:8080/ and then I'm suddenly administering my laptop's CUPS instead of the Pi's CUPS. So a better solution would be appreciated. Thanks!

tpylkko
Posts: 324
Joined: Tue Oct 14, 2014 5:21 pm

Re: Accessing the Pi's CUPS web interface from another compu

Sat Jun 24, 2017 7:32 pm

notice that you are using two distinct domain names for the box. which one is it? maybe use the ip address instead, if you don't know. Or am I misundertanding your setup? It appears that you have a rpi with name .local but you are trying to access .lan. If you are using pi3.local then use http://pi3.local:631

ppelleti
Posts: 5
Joined: Sun Jun 11, 2017 11:00 pm

Re: Accessing the Pi's CUPS web interface from another compu

Sat Jun 24, 2017 8:27 pm

tpylkko wrote:notice that you are using two distinct domain names for the box. which one is it? maybe use the ip address instead, if you don't know. Or am I misundertanding your setup? It appears that you have a rpi with name .local but you are trying to access .lan. If you are using pi3.local then use http://pi3.local:631
Sorry for the confusion. The two addresses are interchangeable, but I should have stuck with one or the other in my example to be clear. My understanding is that .local uses mDNS (Bonjour) to locate the named host, while .lan uses traditional DNS to my router, which assigns names in .lan based on the name the host asked for. (I'm running OpenWRT on my router.) So although they work in completely different ways, .lan and .local give the same result on my network.

So I don't think that has anything to do with the issue at hand, but I shouldn't have confused things by using two different (but equivalent) names.

tpylkko
Posts: 324
Joined: Tue Oct 14, 2014 5:21 pm

Re: Accessing the Pi's CUPS web interface from another compu

Sun Jun 25, 2017 8:15 am

But have you tried accessing the web server with the ip in order to rule out a name resolution problem?

ppelleti
Posts: 5
Joined: Sun Jun 11, 2017 11:00 pm

Re: Accessing the Pi's CUPS web interface from another compu

Sun Jun 25, 2017 6:30 pm

tpylkko wrote:But have you tried accessing the web server with the ip in order to rule out a name resolution problem?
Fascinating... although pi3.lan and pi3.local both resolve to the same IP address (fd42:f8e7:b196::d87), pi3.lan returns a status of "400 Bad Request", while pi3.local returns a status of "200 OK".

With pi3.lan:

Code: Select all

whiteandnerdy:~ ppelleti$ curl -v http://pi3.lan:631/
* Adding handle: conn: 0x7f9b92003a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f9b92003a00) send_pipe: 1, recv_pipe: 0
* About to connect() to pi3.lan port 631 (#0)
*   Trying fd42:f8e7:b196::d87...
* Connected to pi3.lan (fd42:f8e7:b196::d87) port 631 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.30.0
> Host: pi3.lan:631
> Accept: */*
> 
< HTTP/1.1 400 Bad Request
< Date: Sun, 25 Jun 2017 18:18:02 GMT
* Server CUPS/1.7 IPP/2.1 is not blacklisted
< Server: CUPS/1.7 IPP/2.1
< Content-Language: en_US
< Upgrade: TLS/1.2,TLS/1.1,TLS/1.0
< Connection: close
< Content-Type: text/html; charset=utf-8
< Content-Length: 346
< 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
	<TITLE>Bad Request - CUPS v1.7.5</TITLE>
	<LINK REL="STYLESHEET" TYPE="text/css" HREF="/cups.css">
</HEAD>
<BODY>
<H1>Bad Request</H1>
<P></P>
</BODY>
</HTML>
* Closing connection 0
With pi3.local:

Code: Select all

whiteandnerdy:~ ppelleti$ curl -v http://pi3.local:631/
* Adding handle: conn: 0x7fbc7b803a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fbc7b803a00) send_pipe: 1, recv_pipe: 0
* About to connect() to pi3.local port 631 (#0)
*   Trying fd42:f8e7:b196::d87...
* Connected to pi3.local (fd42:f8e7:b196::d87) port 631 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.30.0
> Host: pi3.local:631
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Sun, 25 Jun 2017 18:19:05 GMT
* Server CUPS/1.7 IPP/2.1 is not blacklisted
< Server: CUPS/1.7 IPP/2.1
< Connection: Keep-Alive
< Keep-Alive: timeout=30
< Content-Language: en_US
< Content-Type: text/html; charset=utf-8
< Last-Modified: Tue, 09 Jun 2015 08:06:54 GMT
< Content-Length: 3697
< 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
	<TITLE>Home - CUPS 1.7.5</TITLE>
	<LINK REL="STYLESHEET" TYPE="text/css" HREF="/cups.css">
	<LINK REL="SHORTCUT ICON" HREF="/images/cups-icon.png" TYPE="image/png">
</HEAD>
<BODY>
<TABLE CLASS="page" SUMMARY="{title}">
<TR><TD CLASS="body">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR HEIGHT="36">
<TD><A HREF="http://www.cups.org/" TARGET="_blank"><IMG
SRC="/images/left.gif" WIDTH="64" HEIGHT="36" BORDER="0" ALT=""></A></TD>
<TD CLASS="sel"><A HREF="/">&nbsp;&nbsp;Home&nbsp;&nbsp;</A></TD>
<TD CLASS="unsel"><A HREF="/admin">&nbsp;&nbsp;Administration&nbsp;&nbsp;</A></TD>
<TD CLASS="unsel"><A HREF="/classes/">&nbsp;&nbsp;Classes&nbsp;&nbsp;</A></TD>
<TD CLASS="unsel"><A HREF="/help/">&nbsp;&nbsp;Online&nbsp;Help&nbsp;&nbsp;</A></TD>
<TD CLASS="unsel"><A HREF="/jobs/">&nbsp;&nbsp;Jobs&nbsp;&nbsp;</A></TD>
<TD CLASS="unsel"><A HREF="/printers/">&nbsp;&nbsp;Printers&nbsp;&nbsp;</A></TD>
<TD CLASS="unsel" WIDTH="100%"><FORM ACTION="/help/" METHOD="GET"><INPUT
TYPE="SEARCH" NAME="QUERY" SIZE="20" PLACEHOLDER="Search Help"
AUTOSAVE="org.cups.help" RESULTS="20"></FORM></TD>
<TD><IMG SRC="/images/right.gif" WIDTH="4" HEIGHT="36" ALT=""></TD>
</TR>
</TABLE>

<TABLE CLASS="indent" SUMMARY="">
<TR><TD STYLE="padding-right: 20px;">

<H1>CUPS 1.7.5</H1>

<P>CUPS is the standards-based, open source printing system developed by
<A HREF="http://www.apple.com/">Apple Inc.</A> for OS<SUP>&reg;</SUP> X and
other UNIX<SUP>&reg;</SUP>-like operating systems.</P>

</TD>
<TD><A HREF="http://www.cups.org/"><IMG SRC="images/cups-icon.png" WIDTH="128"
HEIGHT="128" ALT="CUPS"></A></TD>
</TR>
</TABLE>

<TABLE CLASS="indent" SUMMARY="">
<TR><TD VALIGN="top" STYLE="border-right: dotted thin #cccccc; padding-right: 20px;">

<H2>CUPS for Users</H2>

<P><A HREF="help/overview.html">Overview of CUPS</A></P>

<P><A HREF="help/options.html">Command-Line Printing and Options</A></P>

<P><A HREF="help/whatsnew.html">What's New in CUPS 1.7</A></P>

<P><A HREF="http://www.cups.org/lists.php?LIST=cups">User Forum</A></P>

</TD><TD VALIGN="top" STYLE="border-right: dotted thin #cccccc; padding-left: 20px; padding-right: 20px;">

<H2>CUPS for Administrators</H2>

<P><A HREF="admin">Adding Printers and Classes</A></P>

<P><A HREF="help/policies.html">Managing Operation Policies</A></P>

<P><A HREF="help/accounting.html">Printer Accounting Basics</A></P>

<P><A HREF="help/security.html">Server Security</A></P>

<P><A HREF="help/kerberos.html">Using Kerberos Authentication</A></P>

<P><A HREF="help/network.html">Using Network Printers</A></P>

<P><A HREF="help/ref-cupsd-conf.html">cupsd.conf Reference</A></P>

</TD><TD VALIGN="top" STYLE="padding-left: 20px;">

<H2>CUPS for Developers</H2>

<P><A HREF="help/api-overview.html">Introduction to CUPS Programming</A></P>

<P><A HREF="help/api-cups.html">CUPS API</A></P>

<P><A HREF="help/api-filter.html">Filter and Backend Programming</A></P>

<P><A HREF="help/api-httpipp.html">HTTP and IPP APIs</A></P>

<P><A HREF="help/api-ppd.html">PPD API</A></P>

<P><A HREF="help/api-raster.html">Raster API</A></P>

<P><A HREF="help/ref-ppdcfile.html">PPD Compiler Driver Information File Reference</A></P>

<P><A HREF="http://www.cups.org/lists.php?LIST=cups-devel">Developer Forum</A></P>

</TD></TR>
</TABLE>

</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD CLASS="trailer">CUPS and the CUPS logo are trademarks of
<A HREF="http://www.apple.com">Apple Inc.</A> Copyright 2007-2014 Apple
Inc. All rights reserved.</TD></TR>
</TABLE>
</BODY>
</HTML>
* Connection #0 to host pi3.local left intact
So for some reason, the CUPS web server is returning an error for pi3.lan but not for pi3.local, even though they resolve to the same IP address. This is really weird, although it does solve my problem. Thanks!

Return to “Beginners”

Who is online

Users browsing this forum: apoldion, Ektus and 38 guests