mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 00:40:25 +02:00
authorize: fix x-forwarded-uri (#3479)
* authorize: fix x-forwarded-uri * fix raw path
This commit is contained in:
parent
24a9d627cd
commit
bc078f8bd2
3 changed files with 70 additions and 22 deletions
22
internal/urlutil/forward_test.go
Normal file
22
internal/urlutil/forward_test.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package urlutil
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetForwardAuthURL(t *testing.T) {
|
||||
t.Run("double-escaping", func(t *testing.T) {
|
||||
req, err := http.NewRequest("GET", "https://example.com", nil)
|
||||
require.NoError(t, err)
|
||||
req.Header.Set("X-Forwarded-Proto", "https")
|
||||
req.Header.Set("X-Forwarded-Host", "protected-host.tld")
|
||||
req.Header.Set("X-Forwarded-Uri", "/example?a=b&c=d")
|
||||
|
||||
u := GetForwardAuthURL(req)
|
||||
assert.Equal(t, "https://protected-host.tld/example?a=b&c=d", u.String())
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue