Forum Discussion

Christian_Meiss's avatar
Christian_Meiss
Icon for Nimbostratus rankNimbostratus
Jul 22, 2016

ProxyPath adds trailing slash to locations

Hi Folks,

i want to use ProxyPass. In some cases it works fine in other not so. If i have the following data group:

/foo := /

This is very simple and only an example to illustrate the problem.

I would expect that

http://host.domain.tld/foo will show me the contens of http://host.domain.tld/. And that's is. I see the expected content but the ProxyPass added a Slash at the end of the URI so if i wrote

http://host.domain.tld/foo in Browser (or where else) it leads to http://host.domain.tld/foo/.

In some cases this is not wanted because not all tools accept these rewritings at client side.

What goes wrong and how can i fix it?

Cheers Christian

9 Replies

  • ok, that is a lot of code to scan :) but i don't quite get the problem either yet.

     

    first you say /foo becomes /, then /foo becomes /foo/ ?

     

  • I configured the location /foo to show me the content of /. That works.

     

    But the iRule rewrite the requested URI from /foo to /foo/

     

    You can it easy reproduce.

     

    Cheers Christian

     

  • Set the debug level to verbose and duplicate the problem. If the correspondig logs don't point out the isue for you, paste them here (sanitized, of course) and let folks take a look.

     

  • Here is the log abstract for my debug virtual server:

    Jul 25 09:36:45 bigip info tmm3[16928]: Rule /Common/ProxyPass : /Common/debug_730_EP_vs: 10.10.226.172%730:61452 -> 10.10.215.4%730:443
    Jul 25 09:36:45 bigip info tmm3[16928]: Rule /Common/ProxyPass : VS=/Common/debug_730_EP_vs, Host=bigdebug.domain.tld, URI=/foo: Found Rule, Client Host=bigdebug.domain.tld, Client Path=/foo, Server Host=bigdebug.domain.tld, Server Path=/
    Jul 25 09:36:45 bigip info tmm3[16928]: Rule /Common/ProxyPass : VS=/Common/debug_730_EP_vs, Host=bigdebug.domain.tld, URI=/foo: Redirecting to https://bigdebug.domain.tld/foo/
    Jul 25 09:36:45 bigip info tmm3[16928]: Rule /Common/ProxyPass : VS=/Common/debug_730_EP_vs, Host=bigdebug.domain.tld, URI=/foo/: Found Rule, Client Host=bigdebug.domain.tld, Client Path=/foo, Server Host=bigdebug.domain.tld, Server Path=/
    Jul 25 09:36:45 bigip info tmm3[16928]: Rule /Common/ProxyPass : VS=/Common/debug_730_EP_vs, Host=bigdebug.domain.tld, URI=/foo/: Using default pool /Common/debug_730_EP_pool
    Jul 25 09:36:47 bigip info tmm[16928]: Rule /Common/ProxyPass : /Common/debug_730_EP_vs: 10.10.226.172%730:51524 -> 10.10.215.4%730:443
    Jul 25 09:36:47 bigip info tmm[16928]: Rule /Common/ProxyPass : VS=/Common/debug_730_EP_vs, Host=bigdebug.domain.tld, URI=/foo/: Found Rule, Client Host=bigdebug.domain.tld, Client Path=/foo, Server Host=bigdebug.domain.tld, Server Path=/
    Jul 25 09:36:47 bigip info tmm[16928]: Rule /Common/ProxyPass : VS=/Common/debug_730_EP_vs, Host=bigdebug.domain.tld, URI=/foo/: Using default pool /Common/debug_730_EP_pool
    

    To the VS debug_730_EP_vs is the data-group ProxyPassdebug_730_EP_vs attached:

     tmsh list / ltm data-group internal ProxyPassdebug_730_EP_vs
    ltm data-group internal ProxyPassdebug_730_EP_vs {
        records {
            /foo {
                data /
            }
        }
        type string
    }
    

    There is only an entry for /foo not for /foo/ as you can see.

    Hope anyone can help me with these informations.

    Cheers Christian

  • ok, now i see the line which does this, if you feel brave enough change line 198 in the proxy pass irule.

    HTTP::redirect "https://$orig_host$orig_uri/"

    to

    HTTP::redirect "https://$orig_host$orig_uri"

    and you should see a different behaviour, if that works for you be sure to update the log line also

    log local0. "$log_prefix: Redirecting to https://$orig_host$orig_uri/"

    you can also do it for http then, but be sure to test this well, there is a whole blob of text above this section explaing why it is build like this, perhaps changing this will effect something else.

  • "/foo := /" is simply defining what the client side sees vs what the server side sees. And unless I'm mistaken, "/foo" and "/foo/" are the same thing.

     

  • Normally i whould aggree that /foo and /foo/ and also /foo/// is the same thing. But there a circumstances where /foo and /foo/ with an 302 response code is not handleable. An example. There is an x509 certificate and there is the ocsp responder location http://ocsp.domain.tld/foo. Openssl for example can't handle /foo/ and also not /foo with the following 302 with target /foo/.

     

    In simple www things a aggree /foo is the same as /foo/ but not for some other protocols which are handled over http.