* WwwAttach::referer_match and HTTPS
@ 2021-08-06 15:01 Leah Neukirchen
2021-08-06 20:41 ` Eric Wong
0 siblings, 1 reply; 5+ messages in thread
From: Leah Neukirchen @ 2021-08-06 15:01 UTC (permalink / raw)
To: meta
Hi,
I noticed that referer_match in lib/PublicInbox/WwwAttach.pm always
fails over HTTPS on my setup as psgi.url_scheme is set to 'http' in
lib/PublicInbox/HTTPD.pm but I have a HTTPS-terminating proxy in front,
so the referer starts with "https://"
(public-inbox-1.6.1 but same in HEAD afaics.)
Did I forget to set anything, or should referer_match just accept both
http and https?
cu,
--
Leah Neukirchen <leah@vuxu.org> https://leahneukirchen.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: WwwAttach::referer_match and HTTPS
2021-08-06 15:01 WwwAttach::referer_match and HTTPS Leah Neukirchen
@ 2021-08-06 20:41 ` Eric Wong
2021-08-06 20:50 ` Leah Neukirchen
0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2021-08-06 20:41 UTC (permalink / raw)
To: Leah Neukirchen; +Cc: meta
Leah Neukirchen <leah@vuxu.org> wrote:
> Hi,
>
> I noticed that referer_match in lib/PublicInbox/WwwAttach.pm always
> fails over HTTPS on my setup as psgi.url_scheme is set to 'http' in
> lib/PublicInbox/HTTPD.pm but I have a HTTPS-terminating proxy in front,
> so the referer starts with "https://"
> (public-inbox-1.6.1 but same in HEAD afaics.)
>
> Did I forget to set anything, or should referer_match just accept both
> http and https?
Hmm, yes, probably it should unconditionally accept /\Ahttps?/i
iff psgi.url_scheme eq 'http' given the way common configs are.
psgi.url_scheme seems inconsistent and difficult to rely on with
so many possible forwarding proxies and configurations.
There's the Forwarded: (RFC 7239) header nowadays, and
X-Forwarded-* before, though I suspect X-Forwarded-* remains
widely in use.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: WwwAttach::referer_match and HTTPS
2021-08-06 20:41 ` Eric Wong
@ 2021-08-06 20:50 ` Leah Neukirchen
2021-08-08 1:00 ` Eric Wong
0 siblings, 1 reply; 5+ messages in thread
From: Leah Neukirchen @ 2021-08-06 20:50 UTC (permalink / raw)
To: Eric Wong; +Cc: meta
Eric Wong <e@80x24.org> writes:
> Leah Neukirchen <leah@vuxu.org> wrote:
>> Hi,
>>
>> I noticed that referer_match in lib/PublicInbox/WwwAttach.pm always
>> fails over HTTPS on my setup as psgi.url_scheme is set to 'http' in
>> lib/PublicInbox/HTTPD.pm but I have a HTTPS-terminating proxy in front,
>> so the referer starts with "https://"
>> (public-inbox-1.6.1 but same in HEAD afaics.)
>>
>> Did I forget to set anything, or should referer_match just accept both
>> http and https?
>
> Hmm, yes, probably it should unconditionally accept /\Ahttps?/i
> iff psgi.url_scheme eq 'http' given the way common configs are.
> psgi.url_scheme seems inconsistent and difficult to rely on with
> so many possible forwarding proxies and configurations.
>
> There's the Forwarded: (RFC 7239) header nowadays, and
> X-Forwarded-* before, though I suspect X-Forwarded-* remains
> widely in use.
I currently set
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
but not X-Forwarded-Proto...
--
Leah Neukirchen <leah@vuxu.org> https://leahneukirchen.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: WwwAttach::referer_match and HTTPS
2021-08-06 20:50 ` Leah Neukirchen
@ 2021-08-08 1:00 ` Eric Wong
2021-08-08 11:17 ` Leah Neukirchen
0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2021-08-08 1:00 UTC (permalink / raw)
To: Leah Neukirchen; +Cc: meta
Leah Neukirchen <leah@vuxu.org> wrote:
> Eric Wong <e@80x24.org> writes:
>
> > Leah Neukirchen <leah@vuxu.org> wrote:
> >> Hi,
> >>
> >> I noticed that referer_match in lib/PublicInbox/WwwAttach.pm always
> >> fails over HTTPS on my setup as psgi.url_scheme is set to 'http' in
> >> lib/PublicInbox/HTTPD.pm but I have a HTTPS-terminating proxy in front,
> >> so the referer starts with "https://"
> >> (public-inbox-1.6.1 but same in HEAD afaics.)
> >>
> >> Did I forget to set anything, or should referer_match just accept both
> >> http and https?
> >
> > Hmm, yes, probably it should unconditionally accept /\Ahttps?/i
> > iff psgi.url_scheme eq 'http' given the way common configs are.
Nevermind, I don't think that change is necessary (see below)
> > psgi.url_scheme seems inconsistent and difficult to rely on with
> > so many possible forwarding proxies and configurations.
> >
> > There's the Forwarded: (RFC 7239) header nowadays, and
> > X-Forwarded-* before, though I suspect X-Forwarded-* remains
> > widely in use.
>
> I currently set
>
> proxy_set_header X-Forwarded-Host $host;
> proxy_set_header X-Forwarded-Server $host;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>
> but not X-Forwarded-Proto...
Ah, I suggest setting X-Forwarded-Proto.
Plack::Middleware::ReverseProxy (loaded by default) will automatically
parse that and set psgi.url_scheme properly.
(I completely forgot about that middleware :x)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: WwwAttach::referer_match and HTTPS
2021-08-08 1:00 ` Eric Wong
@ 2021-08-08 11:17 ` Leah Neukirchen
0 siblings, 0 replies; 5+ messages in thread
From: Leah Neukirchen @ 2021-08-08 11:17 UTC (permalink / raw)
To: Eric Wong; +Cc: meta
Eric Wong <e@80x24.org> writes:
>> I currently set
>>
>> proxy_set_header X-Forwarded-Host $host;
>> proxy_set_header X-Forwarded-Server $host;
>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>
>> but not X-Forwarded-Proto...
>
> Ah, I suggest setting X-Forwarded-Proto.
> Plack::Middleware::ReverseProxy (loaded by default) will automatically
> parse that and set psgi.url_scheme properly.
>
> (I completely forgot about that middleware :x)
Thanks, that fixes it.
--
Leah Neukirchen <leah@vuxu.org> https://leahneukirchen.org
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-08 11:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-06 15:01 WwwAttach::referer_match and HTTPS Leah Neukirchen
2021-08-06 20:41 ` Eric Wong
2021-08-06 20:50 ` Leah Neukirchen
2021-08-08 1:00 ` Eric Wong
2021-08-08 11:17 ` Leah Neukirchen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).