0

I'm trying to create the following rewrite in nginx:

https://my-domain/app/kibana#/discover?<some-get-params>

to

https://new-domain/app/discover#/?<some-get-params>

I'm struggling I think because of the "#" character. I am able to redirect to the destination, but always without the params.

My last attempt was as follows:

location / {
    rewrite ^/app/kibana#/discover(.*)$ https://my-new-domain.com/app/discover#/$1 redirect;
}

What happens with this one is a 404.

If instead I do something like:

location / {
    rewrite ^/app/kibana(.*)$ https://my-new-domain.com/app/discover#/$args redirect;
}

I get redirected to the right destination but without any args: https://my-new-domain.com/app/discover#/ Same thing if instead of $args I use $1 instead

codiaf
  • 569
  • 2
  • 18
  • 47
  • 1
    The `#` is the beginning of the [URL fragment](https://stackoverflow.com/questions/30997420/what-are-fragment-urls-and-why-to-use-them) which is never sent to Nginx. So Nginx cannot help you here. – Richard Smith Mar 03 '22 at 14:16
  • -.- thanks! I'll have to find a workaround for that then. – codiaf Mar 03 '22 at 14:26

0 Answers0