Are you trying to redirect the user to the page without /admin (first example below), or simply trying to remove the /admin between the LTM and pool member (second example below)? Also, are you trying to pass the request to a specific pool?
HTTP::redirect "http://[HTTP::host]/[string range [HTTP::uri] 6 end]"
The second example isn’t a redirect so I’m not sure why it would change the browser’s request. You mentioned the link points to /directory/…is it coded for that for some reason?
I meant that my application is like a /index.html file in the document root with some
In fact, I found that the problem is absolute links in the application like /directory/foobar.html. I think it would work with relative links. I cannot change absolute links to relative links as I don’t control the application
1. User requests http://myapp.domain.com/admin/ . It works, he gets let’s say “index.html” file (thanks to your tip with HTTP::uri /[string range [HTTP::uri] 6 end]
)
2. User clicks on a link pointing to “/directory/foobar.html”
3. It doesn’t work because in the index.html page the user is getting, the link is “/directory/foobar.html”. And it should be “/admin/directory/foobar.html” to have it redirected properly I think.
1. User requests http://myapp.domain.com/admin/ . It works, he gets let’s say “index.html” file (thanks to your tip with HTTP::uri /[string range [HTTP::uri] 6 end]
)
2. User clicks on a link pointing to “/directory/foobar.html”
3. It doesn’t work because in the index.html page the user is getting, the link is “/directory/foobar.html”. And it should be “/admin/directory/foobar.html” to have it redirected properly I think.
I think I have to rewrite server’s response.
It sounds like index.html is using relative links then, no? If the user gets a 404 for /directory/foobar.html, why are we trying to remove the /admin from the request?
No, index.html uses absolute links : for example, . I mean by absolute links, links absolute relative to the document root, not to the filesystem.
myapp.domain.com points to the “business” application on a certain pool. Adding /admin should point to another pool hosting the admin application. The admin application itself doesn’t have /admin, that’s why we need to keep the /admin on the client side and remove it on the server side.
So, is the issue that the user gets sent to the admin pool by requesting “/admin” which contains /directory/index.html. If the user clicks a link off of index.html, i.e. “/directory/foobar.html,” they’re no longer being sent to the admin pool, but to the business application. Is that the issue?
1. From HTTP_REQUEST, set a variable like “admin” to a value like “1” if [HTTP::path] started with “/admin.” We’d then also get rid of “/admin” before sending the request to the server.
2. From HTTP_RESPONSE, we could check if “admin” equaled “1” and if it did, insert a cookie on the user’s machine.
3. Then, we’d also add logic to our HTTP_REQUEST event so if the user had such a cookie, we’d send them to the admin pool regardless of whether their request contained /admin.
The immediate issue with that would be if the user no longer wanted to go to the admin pool but still had the cookie. I’ll give it some thought and see if I can come up with something.
Unfortunately, we can’t do this. We already have many URLs and we are migrating from a system working with a /admin in the URL. In the previous configuration, there was a HTTP::redirect, so users saw the admin server hostname in the URL. In the new configuration, I’d like to have this name “masqueraded”