« Previous Next »

Thread: Rewrite decodes and changes original url in X_ORIGINAL_URL

Last post 11-03-2008 12:59 PM by kevin.peno. 9 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (10 items)

Sort Posts:

  • 10-27-2008, 2:06 PM

    Rewrite decodes and changes original url in X_ORIGINAL_URL

    Hello,

    Take an example scenario URI: "index/goto/www/return/%2Ftickets%2Fcategory".

    The rewrite module states that it contains the original in the X_ORIGINAL_URL, but the output from that is actually: "index/goto/www/return/tickets/category"

    Any idea on what could cause this?

    Thanks!

  • 10-28-2008, 1:23 PM In reply to

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    Hello,

    If possible I'd love to get a response about this problem. I have a client that I recently moved to IIS7 that is having serious problems with this. I'd rather not have to move them back to IIS6 unless it is completely necessary.

    Thanks,

  • 10-28-2008, 2:04 PM In reply to

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    I just found http://forums.iis.net/p/1152313/1881760.aspx#1881760 and while it says "non-ascii" I noticed in one post that a developer mentioned "not properly encoding urls". So I figured I'd ask before trying because this would be installed on a production server. So, should I try this thing out? If so, what are the possible problems for upgrade in the future?

    Thanks!

  • 10-28-2008, 3:17 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 664

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    The fix for non-ascii characters will not change this behavior.

    IIS gets already decoded URL from https.sys and that is used to set HTTP_X_ORIGINAL_URL as well as any other server variables. This is not specific to URL rewriter and this is how it is in IIS 6.

    Could you explain why it is a problem for your client?

    http://ruslany.net
  • 10-28-2008, 3:42 PM In reply to

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    It seems silly to me that you think the URL above that is given to the server and the URL received in ORIGINAL_URL is "normal". It's quite obvious the change being made and the entire reason for url encoding is for issues just like this. I DONT want the server to proces direcotry slashes, so I encode them. yet your module is decoding them and stripping the duplicate directory slash that it finds in the beginning of the encoded string. On IIS6 with ISAPI Rewrite (or on apache) this is not a problem.

    The reason this is a problem for us currently is that we are using an encoded URL within the URL to store transportation information. In this client's case, they have categories within the site that require that you be within a subsite or "locale" as it's called. So, when these areas are accessed, if a locale is not set, then the user is redirected to a "choose locale" page. During this redirection, we send the "last visited" page encoded in the url so that, upon selecting a locale, the user is sent back to the page in which they came from.

    You can try this out if you like. We are using Zend, so after a bit of thought I was able to develop a route to handle the bug, but it really shouldn't be necessary. Here's the steps to follow on the client site:

    1. Click on a business directory (3rd column from the left)
    2. You'll end up on the choose locale page, notice the URL you are given.
    3. Now, assuming this rewrite module worked, and I didn't have a Zend route in place to "fix" the problem, you would click on the locale on the right and be redirected to the page you came from.

    I hope that clears up the problem a bit more and we can find some sort of resolution. I KNOw that the way it is being handled isn't the "best" but it's not my choice on the matter unfortunately. :)

    Thanks,

  • 10-28-2008, 7:54 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 664

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    Do you need to use original encoded URL to construct the links in your web application only? Or do your rewrite rules rely on the URL being encoded when doing pattern matching?

    http://ruslany.net
  • 10-28-2008, 11:24 PM In reply to

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    Hi,

    All urls are rewritten to index.php. PHP calls _SERVER['X_ORIGINAL_URL'] to get the original url and ZF takes it from there.

    Thanks,

  • 10-29-2008, 12:38 AM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 664

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    Ok. I think this is clear to me know. This looks like a common approach used by PHP apps, where everything is rewritten to index.php and then the app figures out what to do based on original url.

    I'll let you know what we'll decide on this.

    http://ruslany.net
  • 11-03-2008, 12:52 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 664

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    In the upcoming RTW release, URL rewriter will set another IIS server variable - UNENCODED_URL - to contain the raw URL exactly as it was requested by the browser (all encoding preserved).

    HTTP_X_ORIGINAL_URL will still contain decoded URL.

    http://ruslany.net
  • 11-03-2008, 12:59 PM In reply to

    Re: Rewrite decodes and changes original url in X_ORIGINAL_URL

    At least I've got something I guess. Thanks for looking in to it.

Page 1 of 1 (10 items)
Microsoft Communities