Using URL rewrite to "change domain" and hide ugly linksRSS

4 replies

Last post Jul 06, 2019 05:33 AM by Chris Becke

  • Using URL rewrite to "change domain" and hide ugly links

    Jun 28, 2019 11:37 AM|bosma1992|LINK

    Hi, 

    I have the following situation:

    • We have an application that publishes dashboards, which produces very long, very ugly links (example: http:// server. domain/ibmcognos/bi/?pathRef=.public_folders%2FAM%2BStuurt%2521%2FBeheerde%2Bproducten%2FDBAM%2FRapporten%2FDashboard%2Bassetmanagement

    There is a (different) server with IIS, on which we have folders in the wwwroot folder, to make them accessible by shortcuts (for the above example, http://123.a.b.nl/DBAM is the shortcut) (not really, just not so keen on giving out the domain name).

    In the DBAM folder there is an index.htm and web.config file.

    We used to use iframes to load up the page mentioned above, but some of the functionality isn't working (popups not showing). 

    Now I'm trying to redirect users to the correct URL (long and ugly) but make their browser display the "clean" URL. 

    I'm doing this with a <meta http-equiv="refresh"> tag in index.htm. 

    the dashboard gets loaded correctly after the meta http refresh, displaying the ugly url, all functionality is enabled. 

    My question: How would one go about making sure the user does not see the "ugly" links? 

    It's my understanding that IIS URL REWRITE is applied before the refresh, so useless afterwards. 

    Please enlighten me. 

    PS, my title is this way, because the idea is to change the ugly url from one server (http://serverA*****) to (http://server2****

  • Re: Using URL rewrite to "change domain" and hide ugly links

    Jun 28, 2019 02:06 PM|lextm|LINK

    bosma1992

    Now I'm trying to redirect users to the correct URL (long and ugly) but make their browser display the "clean" URL. 

    That's completely wrong. Use both inbound and outbound rules to clean up the URLs, and that's enough.

    Lex Li
    IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Using URL rewrite to "change domain" and hide ugly links

    Jul 01, 2019 06:37 AM|bosma1992|LINK

    Could you maybe elaborate with an example of how to configure this?

    I'm not really an IIS guru as you might've already guessed.

  • Re: Using URL rewrite to "change domain" and hide ugly links

    Jul 01, 2019 06:13 PM|lextm|LINK

    Lex Li
    IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Using URL rewrite to "change domain" and hide ugly links

    Jul 06, 2019 05:33 AM|Chris Becke|LINK

    UrlRewrite does not have a lot to work with, only the url and query string you provide it, so the iframe solution might be unavoidable if there are lots of dashboards or if the dashboards need their urls to be heavily customized.

    The best you can do with a pure UrlRewrite solution would be to create neat form url's that contain all the information required to rebuild the ugly form url. Depending on how many reports there are, this might just entail "lots" of UrlRewrite rules

    i.e. You could create rules on your ARR server that would remap urls like "https://reports.example.com/assets/DBAM" to links like the above using something similar to this:

    A match pattern (regex) of "^assets/(.*)"

    A condition that {HTTP_HOST} matches "^reports(?:\.example\.com)"

    and a Rewrite rule with a Url: "http://server. domain/ibmcognos/bi/?pathRef=.public_folders%2FAM%2BStuurt%2521%2FBeheerde%2Bproducten%2F{R:1}%2FRapporten%2FDashboard%2Bassetmanagement"

    And of course, stop processing any more rules.

    Repeat for every other dashboard.