0

The main problem client hasn't support redirection and can't generate URLs with trailing slash.

The backend uses openAPI and supports URLs only with a trailing slash. I am and kubernetes ingress in the middle. I can't change client or backend.

I am trying to rewrite the target URL on the ingress side, unfortunately, I couldn't find a solution without redirection.

I've tried solution from this case, but it generate 302 code Moved Temporarily and the client can't handle this redirection.

Is it possible to rewrite the URL on nginx ingress side without redirection?

  • Hi Sergey and welcome! I believe Nginx will , by default try and add a trailing slash to whatever url in order to match a proper location block. I get that maybe it's not exactly what you mean but maybe you want to have a look at this https://stackoverflow.com/a/49768054/7120073 which is the opposite of your situation, it removes trailing slash. But i am sure it can be used wisely to add it as well. Let us know! Take care! – OldFart Aug 10 '21 at 05:16
  • Hi, unfortunately, described solution is some kind of redirect, that client can't handle (codes 301/302/308 are not supported on the client-side). It uses the same approach as nginx.ingress.kubernetes.io/rewrite-target annotation. –  Aug 10 '21 at 08:37

0 Answers0