You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying the Kubernetes Ingress feature for the loadbalancing task in a project of moving to kubernetes deployments. The nginx ingress controller seems to be more stable and mature, so I'm using it for the task.
With my setup, I have to use the rewrite-target annotation, because I have 2 types of containers to proxy, so I use a different path for each of them, but I don't want that path to be forwarded to the apps running in the containers, so I just use rewrite-target: / and the apps running in the containers receive the requests as if they were for the root path /.
The problem is that when I try to access to any of the apps with my browser, it connects with the app, but then the response may include some redirection (for example adding a trailing /) and that redirection is to the root path /, without including the app's path as indicated in the ingress rule. Even if I use a path so I wouldn't get any redirect response from the app, the browser downloads the HTML correctly, but all the elements like css or images are pointing to the root path / also, so the browser is not able to download them. (the apps that I'm running in the containers are Oracle WebLogic Server instances, some are admin servers and other ones are managed servers with some JEE apps deployed).
Is there any way to achieve the path rewriting in both directions, so the requests to the app's relative path would be rewritten to the root path, but all the returning requests to the root path would be rewritten in the opposite way, from root path to the relative path, so the client's browser could successfully get the following requests.
So with this setup, I basically make a request to NGINX_IP/adminapp/console/, and it tries to redirect me to NGINX_IP/console/login/LoginForm.jsp, but this request fails because it doesn't include the adminapp prefix in the path. It would work if the request was NGINX_IP/adminapp/console/login/LoginForm.jsp instead. In fact, if I manually change the request path to NGINX_IP/adminapp/console/login/LoginForm.jsp, it downloads the HTML of that page, but all the resources of that page point to paths in the NGINX_IP/console/*.png format, so all of them fail.
Is it possible to fix this situation and get all of the requests correctly rewritten, in both ways of the connections (to and from the upstream servers) ?
I would really appreciate any help!
The text was updated successfully, but these errors were encountered:
Is it possible to fix this situation and get all of the requests correctly rewritten, in both ways of the connections (to and from the upstream servers) ?
You can achieve this using the sub_filter module, something like
Ingress controller:
nginx-ingress-controller version: 0.9.0-beta5
I'm trying the Kubernetes Ingress feature for the loadbalancing task in a project of moving to kubernetes deployments. The nginx ingress controller seems to be more stable and mature, so I'm using it for the task.
With my setup, I have to use the
rewrite-target
annotation, because I have 2 types of containers to proxy, so I use a different path for each of them, but I don't want that path to be forwarded to the apps running in the containers, so I just userewrite-target: /
and the apps running in the containers receive the requests as if they were for the root path/
.The problem is that when I try to access to any of the apps with my browser, it connects with the app, but then the response may include some redirection (for example adding a trailing
/
) and that redirection is to the root path/
, without including the app's path as indicated in the ingress rule. Even if I use a path so I wouldn't get any redirect response from the app, the browser downloads the HTML correctly, but all the elements like css or images are pointing to the root path/
also, so the browser is not able to download them. (the apps that I'm running in the containers are Oracle WebLogic Server instances, some are admin servers and other ones are managed servers with some JEE apps deployed).Is there any way to achieve the path rewriting in both directions, so the requests to the app's relative path would be rewritten to the root path, but all the returning requests to the root path would be rewritten in the opposite way, from root path to the relative path, so the client's browser could successfully get the following requests.
I'm using the following ingress rules descriptor:
So with this setup, I basically make a request to
NGINX_IP/adminapp/console/
, and it tries to redirect me toNGINX_IP/console/login/LoginForm.jsp
, but this request fails because it doesn't include theadminapp
prefix in the path. It would work if the request wasNGINX_IP/adminapp/console/login/LoginForm.jsp
instead. In fact, if I manually change the request path toNGINX_IP/adminapp/console/login/LoginForm.jsp
, it downloads the HTML of that page, but all the resources of that page point to paths in theNGINX_IP/console/*.png
format, so all of them fail.Is it possible to fix this situation and get all of the requests correctly rewritten, in both ways of the connections (to and from the upstream servers) ?
I would really appreciate any help!
The text was updated successfully, but these errors were encountered: