mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 08:32:39 +03:00
Merge pull request #6914 from urbit/m/eyre-respect-forwarded-host
eyre: respect host from Forwarded header, if set
This commit is contained in:
commit
da7ed92577
@ -798,14 +798,15 @@
|
|||||||
=* headers header-list.request
|
=* headers header-list.request
|
||||||
:: for requests from localhost, respect the "forwarded" header
|
:: for requests from localhost, respect the "forwarded" header
|
||||||
::
|
::
|
||||||
=/ [secure=? =^address]
|
=/ [secure=? host=(unit @t) =^address]
|
||||||
=* same [secure address]
|
=/ host=(unit @t) (get-header:http 'host' headers)
|
||||||
|
=* same [secure host address]
|
||||||
?. =([%ipv4 .127.0.0.1] address) same
|
?. =([%ipv4 .127.0.0.1] address) same
|
||||||
?~ forwards=(forwarded-params headers) same
|
?~ forwards=(forwarded-params headers) same
|
||||||
:- (fall (forwarded-secure u.forwards) secure)
|
:+ (fall (forwarded-secure u.forwards) secure)
|
||||||
|
(clap (forwarded-host u.forwards) host head)
|
||||||
(fall (forwarded-for u.forwards) address)
|
(fall (forwarded-for u.forwards) address)
|
||||||
::
|
::
|
||||||
=/ host (get-header:http 'host' headers)
|
|
||||||
=/ [=action suburl=@t]
|
=/ [=action suburl=@t]
|
||||||
(get-action-for-binding host url.request)
|
(get-action-for-binding host url.request)
|
||||||
::
|
::
|
||||||
@ -3241,6 +3242,12 @@
|
|||||||
%https `&
|
%https `&
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ forwarded-host
|
||||||
|
|= forwards=(list (map @t @t))
|
||||||
|
^- (unit @t)
|
||||||
|
?. ?=(^ forwards) ~
|
||||||
|
(~(get by i.forwards) 'host')
|
||||||
|
::
|
||||||
++ parse-request-line
|
++ parse-request-line
|
||||||
|= url=@t
|
|= url=@t
|
||||||
^- [[ext=(unit @ta) site=(list @t)] args=(list [key=@t value=@t])]
|
^- [[ext=(unit @ta) site=(list @t)] args=(list [key=@t value=@t])]
|
||||||
|
Loading…
Reference in New Issue
Block a user