mvysny / shepherd

Build & run apps automatically
1 stars 0 forks source link

http 302 location not rewritten #18

Closed mvysny closed 1 year ago

mvysny commented 1 year ago

When deploying a Spring Boot app with Spring Security, new user gets redirected to the /login page by Spring. It's done by emitting a HTTP 302 with Location set to https://v-herd.eu/login, which of course doesn't work.

We need to configure Kubernetes Ingress (Nginx) to rewrite the Location in HTTP 302 requests. Couple of pointers:

mvysny commented 1 year ago

Yup I need to set the nginx.ingress.kubernetes.io/proxy-redirect-from and nginx.ingress.kubernetes.io/proxy-redirect-to manually since they're by default off, as per kubernetes ingress nginx documentation.

I need to rewrite a request from https://v-herd.eu/login to https://v-herd.eu/app/login. I think the correct values for them are:

mvysny commented 1 year ago

That works, but the follow-up redirect request on successful login ends up at https://v-herd.eu/.

I think I need to generify the rule to redirect https://v-herd.eu to https://v-herd.eu\$1

mvysny commented 1 year ago

That worked well! The correct rules for Spring Security are therefore:

I'll update readme