user/dev discussion of public-inbox itself
 help / color / Atom feed
0f667822ddb4246d89fc74240e247026fb212ce3 blob 1352 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 
#!/usr/bin/perl -w
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
#
# NewsWWW may be used independently of WWW.  This can be useful
# for mapping HTTP/HTTPS requests to the hostname of an NNTP server
# to redirect users to the proper HTTP/HTTPS endpoint for a given
# inbox.  NewsWWW exists because people (or software) can mishandle
# "nntp://" or "news://" URLs as "http://" (or "https://")
#
# Usage:
#	plackup -I lib -o 127.0.0.1 -R lib -r examples/newswww.psgi
use strict;
use warnings;
use Plack::Builder;
use PublicInbox::WWW;
use PublicInbox::NewsWWW;

my $newswww = PublicInbox::NewsWWW->new;

# Optional, (you may drop the "mount '/'" section below)
my $www = PublicInbox::WWW->new;
$www->preload;

builder {
	# HTTP/1.1 requests to "Host: news.example.com" will hit this:
	mount 'http://news.example.com/' => builder {
		enable 'Head';
		sub { $newswww->call($_[0]) };
	};

	# rest of requests will hit this (optional) part for the
	# regular PublicInbox::WWW code:
	# see comments in examples/public-inbox.psgi for more info:
	mount '/' => builder {
		eval {
			enable 'Deflater',
				content_type => [ qw(
					text/html
					text/plain
					application/atom+xml
					)]
		};
		eval { enable 'ReverseProxy' };
		enable 'Head';
		sub { $www->call($_[0]) }
	};
}
debug log:

solving 0f66782 ...
found 0f66782 in https://80x24.org/public-inbox.git

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox