Add support for Varnish/caching layer

This topic contains 5 replies, has 3 voices, and was last updated by  deanbarrow 9 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #33096

    deanbarrow
    Buyer
    Post count: 17

    I found a bug after using Avada theme and found ‘avada_before_main’ wasn’t triggering.

    I’m running a reverse proxy therefore my webserver/php is running on a different port (8080), as such geodir_curPageURL() reports that the directory is running on port 8080 and not 80 as seen externally.

    For a temporary fix I’ve modified geodir_curPageURL() to ignore the port and now ‘avada_before_main’ is behaving as expected.

    function geodir_curPageURL() {
    $pageURL = ‘http’;
    if (isset($_SERVER[“HTTPS”]) && $_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;}
    $pageURL .= “://”;
    //if ($_SERVER[“SERVER_PORT”] != “80”) {
    //$pageURL .= $_SERVER[“SERVER_NAME”].”:”.$_SERVER[“SERVER_PORT”].$_SERVER[“REQUEST_URI”];
    //} else {
    $pageURL .= $_SERVER[“SERVER_NAME”].$_SERVER[“REQUEST_URI”];
    //}
    //return str_replace(“www.”, “”, $pageURL);
    return $pageURL;
    }

    Is it worth putting an option somewhere to either autodetect this somehow, or a checkbox in the admin section to ignore the port number?
    Failing that, could you add a filter so I can override this in my functions.php?

    #33112

    Paolo
    Site Admin
    Post count: 31206

    Hi Dean,

    thanks for spotting this, I’ve reported to developers your finding and they will update you as soon as possible.

    Cheers,

    #33127

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Thanks dean, instead of that i have applied a filter to the return value so that it opens up lost of options for people.

    return apply_filters('geodir_curPageURL',$pageURL);

    if you need an example of how to use this please just ask.

    Thanks,

    Stiofan

    #33132

    deanbarrow
    Buyer
    Post count: 17

    Thanks for the quick turnaround. So I can just add the below to functions.php it’ll be okay?

    function fix_geodir_curPageURL() {
    $pageURL = ‘http’;
    if (isset($_SERVER[“HTTPS”]) && $_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;}
    $pageURL .= “://”;
    $pageURL .= $_SERVER[“SERVER_NAME”].$_SERVER[“REQUEST_URI”];
    return $pageURL;
    }
    add_filter(‘geodir_curPageURL’, ‘fix_geodir_curPageURL’);

    #33134

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    yeah that should do it 🙂

    #33141

    deanbarrow
    Buyer
    Post count: 17

    Great, thanks! 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket