I’m struggling to intercept a redirect from a backend site.
I have a route from
https://example.pomerium.mydomain.com
to
https://test.example.com
Normally, when I access something.example.com
, I will be redirected to either
/login
or
/app/
(when I’m already logged in)
But when I access https://example.pomerium.mydomain.com
I get a 301 redirect to https://test.example.com/app/
, which puts me “outside” Pomerium again
If I’m not logged in, I’m redirected to /login, which initially doesn’t work, but I got around it with a response header rewrite:
rewrite_response_headers:
- header: Location
prefix: https://test.example.com/login
value: http://example.pomerium.mydomain.com/login
Now if I access /app directly, everything seems to work:
https://example.pomerium.mydomain.com/app/
But I would like to not have to instruct the users to manually include /app/
I experimented with path_redirect and some other redirects, but while the config doesn’t break ( I can start the application), it also doesn’t seem to work the way I want it to.
What did you expect to happen?
I expected Pomerium to “catch” the redirect and translate it to https://example.pomerium.mydomain.com/app/
What’s your environment like?
- Pomerium version (retrieve with
pomerium --version
): 0.20.0-1668445494+9413123c - Server Operating System/Architecture/Cloud: RHEL 8.7
What’s your config.yaml?
routes:
- from: https://example.pomerium.mydomain.com
to: https://test.example.com
rewrite_response_headers:
- header: Location
prefix: https://test.example.com/login
value: http://example.pomerium.mydomain.com/login
policy:
- allow:
or:
- domain:
is: mydomain.com
redirect:
path: /
path_redirect: /app/
What did you see in the logs?
Nothing useful in the logs
Additional context
Are there any examples as to how to configure the redirects? I struggle to make sense of the docs for this feature:
-
path_redirect
(string): the incoming path portion of the URL will be swapped with the given value.
Does this mean that ANY path after the host will be swapped, or can you set a from and to value here (like I’ve tried to do in my config)?