0

I use an application that runs on Tomcat and an Nginx as reverse Proxy. To Log in with the application, the user has to either type in his user group, a user name and his password or use a specific URL in which the user group is already choosen with by an ID.

The URL with the ID looks something like this: localhost/login?id=[id] Since the IDs are pretty long and ugly, I want to use the Group-Name, which are unique anway. So instead of typing in localhost/login?id=fdfd-34fd3fd-de4334fd-d3235fd the use just has to type localhost/login?id=GroupName

Is there a way to set up either Tomcat or nginx to replace the value of GroupName to fdfd-34fd3fd-de4334fd-d3235fd internally, so that the use won't see the ID but the server knows which ID to pick?

Since the Groups are all static, that can be done staticly from now on.

tdog
  • 1

1 Answers1

0

Write redirects as below in Nginx. There should be separate entry for each static group-id map. User will still see the url with group name in url. but the id will be passed to tomcat hidden.

rewrite ^/login?id=GroupName$ /login?id=fdfd-34fd3fd-de4334fd-d3235fd break;
Thanga
  • 7,811
  • 3
  • 19
  • 38
  • That does not work. When I try to login with that setting, the value "GroupName" is used as an ID for the login-request. But I have to change that value to the real ID. – tdog Dec 18 '15 at 12:19
  • As per this setting, if the GroupName="testgroup", user hits http://localhost/login?id=testgroup, It will work. If there is any arguments with the url, then the regex has to be changed a little bit. – Thanga Dec 18 '15 at 12:27