Forum Discussion

Brian_Saunders1's avatar
Brian_Saunders1
Icon for Altostratus rankAltostratus
Mar 07, 2014

ProxyPass Appending "/" to URI 404 Error

Hey All,

Need a bit of assistance here, thinking this should be an easy fix but I can't figure it out. Testing out the ProxyPass iRule so that when the end users enters a URL they get redirected but the URL remains the same from their perspective. ProxyPass is working but it's appending a "/" at the end of the URI and that path isn't on the server. Here are the debug logs:

    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : devpasswordreset.environment.dev_443: 10.10.10.10:55759 -> 172.30.25.84:443
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Found Rule, Client Host=devpasswordreset.environment.dev, Client Path=, Server Host=devpasswordreset.environment.dev, Server Path=/rdweb/pages/en-us/devpassword.aspx
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Using default pool devpasswordreset.environment.dev_80
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: New Host=devpasswordreset.environment.dev, New Path=/rdweb/pages/en-us/devpassword.aspx/
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Removed Accept-Encoding header
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: 404 response from devpasswordreset.environment.dev_80 172.30.26.98 80
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: $stream_expression_cmd: STREAM::expression "@devpasswordreset.environment.dev/rdweb/pages/en-us/devpassword.aspx@devpasswordreset.environment.dev@ @/rdweb/pages/en-us/devpassword.aspx@@", $stream_enable_cmd: STREAM::enable
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Successfully configured and enabled stream filter
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Checking Location=, $protocol=
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Checking Content-Location=, $protocol=
    Mar  6 22:51:39 local/tmm info tmm[4929]: Rule devpasswordreset.environment.dev : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Checking URI=, $protocol=

Here's a packet capture of the server side:

Is there anything I need to tweak to keep this from happening?

Thanks,

Brian

  • Hi!

    That rule was cool! And complex. A brief look though showed a redirect that adds a "/". Has there been a redirect before the request in your pcap?

    If there has, what happens if you remove it?

    Please don't test that in prod, because I'm just wildly guessing.

    Talking about this part:

    if {$is_https == 1} {
        HTTP::redirect "https://$orig_host$orig_uri/"
        if { $static::ProxyPassDebug } {
            log local0. "$log_prefix: Redirecting to https://$orig_host$orig_uri/"
        }
    } else {
        HTTP::redirect "http://$orig_host$orig_uri/"
        if { $static::ProxyPassDebug } {
            log local0. "$log_prefix: Redirecting to http://$orig_host$orig_uri/"
        }
    }
    return
    

    Maybe change it to this:

    if {$is_https == 1} {
        HTTP::redirect "https://$orig_host$orig_uri"
        if { $static::ProxyPassDebug } {
            log local0. "$log_prefix: Redirecting to https://$orig_host$orig_uri"
        }
    } else {
        HTTP::redirect "http://$orig_host$orig_uri"
        if { $static::ProxyPassDebug } {
            log local0. "$log_prefix: Redirecting to http://$orig_host$orig_uri"
        }
    }
    return
    

    /Patrik

  • So I updated your iRule to what you suggested and it's still adding the "/" to the end of the uri, here's the log:

    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : devpasswordreset.environment.dev_443: 10.67.36.185:56223 -> 172.30.25.84:443
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Found Rule, Client Host=devpasswordreset.environment.dev, Client Path=/, Server Host=devpasswordreset.environment.dev, Server Path=/rdweb/pages/en-us/devpassword.aspx/
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Using default pool devpasswordreset.environment.dev_80
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: New Host=devpasswordreset.environment.dev, New Path=/rdweb/pages/en-us/devpassword.aspx/
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Removed Accept-Encoding header
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: 404 response from devpasswordreset.environment.dev_80 172.30.26.98 80
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: $stream_expression_cmd: STREAM::expression "@devpasswordreset.environment.dev/rdweb/pages/en-us/devpassword.aspx/@devpasswordreset.environment.dev/@ @/rdweb/pages/en-us/devpassword.aspx/@/@", $stream_enable_cmd: STREAM::enable
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Successfully configured and enabled stream filter
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Checking Location=, $protocol=
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Checking Content-Location=, $protocol=
    
    Mar  7 07:19:08 local/tmm info tmm[4929]: Rule ProxyPass : VS=devpasswordreset.environment.dev_443, Host=devpasswordreset.environment.dev, URI=/: Checking URI=, $protocol=
    

    My datagroup is setup like

    / := devpasswordreset.environment.dev/rdweb/pages/en-us/devpassword.aspx
    
    • Patrik_Jonsson's avatar
      Patrik_Jonsson
      Icon for MVP rankMVP
      If someone else doesn't answer I'll try to study the rule and have an answer next Monday. But it's way more complex than I'm used to so I hope I'm not in over my head. :)