I have a java application which is behind nginx proxy pass.
When the URL is called the application automatically creates a path for the served content.
So when you call
https://somedomain.com
you get https://somedomain.com/todayisaniceday
This is the the proxy pass directive and the rewrite rule in my nginx:
location /URI{
proxy_pass http://IP:PORT/URI ;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
location ~ ^/([a-zA-Z0-9=\?]+)$ {
rewrite ^/(.*)$ / break;
}
I'm implementing one token authentication mechanism.
What I would like to achieve is the following:
when you call:
https://somedomain.com/something?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
The URL will stay and will be not rewritten by the java application.
So basically when there is this string ?jwt=
in the url it should keep it and everything behind it.
I was trying something like this:
rewrite ^/(.*)$ /?jwt=$1 break;
but without success.
Any ideas ?
Thanks for the help.
Asked by DaWe4444
(123 rep)
Jun 6, 2017, 02:02 PM
Last activity: Jun 6, 2017, 02:30 PM
Last activity: Jun 6, 2017, 02:30 PM