3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CUPS WEB UI にアクセスできない

Last updated at Posted at 2020-09-07

「Raspberry Pi で FAX 受信専用サーバ」
https://qiita.com/nanbuwks/items/68a6c9fc9a41dc41dcc7

でプリンタトラブルが発生したので CUPS でアクセスしようとしたら「不正なリクエスト」と出た

image.png

環境


$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.13 (stretch)
Release:	9.13
Codename:	stretch
  • CUPS 2.2.1

cups.conf の記述は
「Raspberry Pi で FAX 受信専用サーバ」
https://qiita.com/nanbuwks/items/68a6c9fc9a41dc41dcc7
の通り。

アクセス元

Chrome バージョン: 84.0.4147.125(Official Build) (64 ビット)
Raspbian GNU/Linux 9

通信路

sshポートフォワードで以下のように通信路を確保


 sudo ssh -g -L  632:192.168.0.212:631 123.456.789.012

123.456.789.012 というのは例示のためのアドレスで、本来は正当なIPアドレスが入る。
123.456.789.012 アドレスで相手方ネットワークの ssh ドアにアクセスし、相手側ネットワーク内の 192.168.0.212 の CUPS サーバに接続する。

CUPSサーバのサービスポート631と、アクセス元のポート632をバインドしている。

症状

「不正なリクエスト」
image.png

上記通信経路を確保しているので、アクセス元からは locahost:632 と司令することで相手方ネットワークの 192.168.0.202:631 にアクセスできる。

なお、相手方ネットワークのいずれかのホストから 192.168.0.202:631 としてアクセスすると正常に動作する。

あれれ〜?

「Raspberry Pi 2 をプリントサーバ化しようとしたが失敗したときのメモ - カタカタブログ」
https://totech.hateblo.jp/entry/2015/05/30/155539
を参考にして、http://locahost:632ではなく http://127.0.0.1:632 とするとアクセスできた。

image.png

なんと、HTTP_HOSTを見ているっぽいですね。

「Using host name in /etc/cups/cupsd.conf Listen directive could make cupsd listen on the wrong IP」
https://github.com/apple/cups/issues/4618
が関係しているかな?

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?