I'm trying to implement some very simple URL's in Confluence to take users to common information. So for example, have the URL http://conf5/phones take the user to a page in a given space that contains information about our company phone system. Using mod_rewrite, I mostly have things the way I want, here is the relevant part of the Apache config:
RewriteEngine On RewriteRule ^/phones$ /display/ds/Phones [PT] ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://conf5:8090/ ProxyPassReverse / http://conf5:8090/ ProxyHTMLURLMap / /confluence/
With this configuration, if a user is authenticated and they enter the URL http://conf5/phones, they are taken to the correct page and the browser bar is unchanged. However, if the user is not authenticated, they are taken to the login page, and then following the login, although they are taken to the correct page, I lose the simple URL and it changes back to the *actual* URL http://conf5/display/ds/Phones.
This brings me to my question, how can I preserve the rewritten URL through the authentication process so the user always sees http://conf5/phones in their browser bar?
The login filter user uses the param os_destination to redirect you to the place you originally came from. I suppose you could get the behavior you want by setting a mod_rewrite to 301 the reqeust back to your conf5/display/ds/Phones if you detect that the referrer was the login page and that the reqeust goes to display/ds/Phones.
It's kind of brute force :(
Thanks, I had since noticed the os_destination in the browser bar:
login.action?os_destination=%2Fdisplay%2Fds%2FPhones
I've been thinking that perhaps a combination of mod_rewrite and the Confluence UrlRewriteFilter might do what I need, or perhaps just using the UrlRewriteFilter by itself. However, I'm running into Apache giving me 'too many redirects' errors when using both together, and the UrlRewriteFilter is giving me an exception when I use it by itself with the rule type set to 'passthrough'.
Do you have an idea of how one would write a rewrite rule that detects the referrer as the login page? I would be curious to try that and see if it ends up in a too many redirects situation or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
RewriteCond %{HTTP_REFERER} yourdomain.com/login.action
RewriteRule blah blah blah.
Untested, but I don't see why it wouldn't work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I played around with the RewriteCond but haven't been able to get it to trigger a match. I added the following to my Apache config:
RewriteLog logs/rewrite_log RewriteLogLevel 9 RewriteCond %{HTTP_REFERER} /login\.action [NC] RewriteRule ^/phones$ /display/ds/Phones [PT,L]
Using Safari with the Web Inspector turned on, it shows the referer page and seems like it should match following the login, but it doesn't.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.