AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
  • 1.  IBM HTTP Server/Apache - RedirectRule & URL Cache &

    Posted Tue April 13, 2021 08:50 PM
    Hi all

    I have two J2EE apps running in WAS, and hosted by IHS in front.

    For the longest time, my RewriteRule (in IHS virtualhost stanza) is pointed to the first app https://hostalias.domain/app1url. When I change the rewriterule to https://hostalias.domain/app2url and restarted apache, i'm still redirected to https://hostalias.domain/app1url.
    I have to clear my web browser's cache first in order for the redirection to app2url take effect.

    Is there a URL caching in IHS layer? I'm thinking if there's such a way to clear it so I don't have to manually clear in my browser.

    Hope someone can help me on this.


    Thanks a lot for the time!

    ------------------------------
    Senen Jr Dimanahan
    ------------------------------


  • 2.  RE: IBM HTTP Server/Apache - RedirectRule & URL Cache &

    Posted Wed April 14, 2021 03:26 AM
    Hello,

    30x errors are almost always cached by the browser. Apache httpd / IHS by itself does not cache anything (except if you do include a cache module and configure it)
    You might try forcing a redirect with a Cache-control header with no-store value to avoid it being cached, but I have not tested it. To achieve that you would need to set an environmental variable in the RewriteRule and use mod_headers to return the header I mentioned based on the presence of that environmental.

    ------------------------------
    Carlos G.B.
    ------------------------------



  • 3.  RE: IBM HTTP Server/Apache - RedirectRule & URL Cache &

    Posted Thu April 15, 2021 01:38 AM
    Hi there!

    Thanks a lot for the tip. Yeah, it seems that cache module is how IHS uses cache.
    Will surely try this and will tell the results.

    Thanks for the time, and best regards!

    ------------------------------
    Senen Jr Dimanahan
    ------------------------------



  • 4.  RE: IBM HTTP Server/Apache - RedirectRule & URL Cache &

    Posted Mon April 19, 2021 10:12 PM
    Hi there,

    It turns out that having only R, instead of R=301 or R=302 will prevent the redirection being cached in the browser.
    This works for me,
    RewriteRule ^/{SomePattern}$ /{URL} [R]


    Although I did create an environment variable, and added header options,

    SetEnv OpenURL /URL1
    SetEnv CloseURL /URL2
    Header always set Cache-Control "no-store, no-cache, must-revalidate" env=OpenURL
    Header always set Cache-Control "max-age=60" env=CloseURL


    But I think the [R] redirection flag alone should be sufficient.

    ------------------------------
    Senen Jr Dimanahan
    ------------------------------