aMember Remote Cronjob Issue

Discussion in 'Setting-up protection' started by aronprins, Dec 24, 2014.

Thread Status:
Not open for further replies.
  1. aronprins

    aronprins aMember Pro Customer

    Joined:
    Sep 1, 2014
    Messages:
    12
    Hey all,

    Hope someone can help me with this.
    I have aMember remote installed on a diffrent server then the aMember root install.

    The folder that is protected has a cron setting which is called via a Cronjob Line in DirectAdmin.
    Now, since this folder is protected the cron url is not reachable for the server.

    Is there a way to exclude that specific url so it's accessable even if there's no active login?

    The cron url is: http://www.domain.com/codeignitor_system_url/index.php/cron/

    This is my .htaccess that aMember remote generated:

    ########### AMEMBER START #####################
    Options +FollowSymLinks
    RewriteEngine On

    ## allow access for product #3
    RewriteCond %{HTTP_COOKIE} amember_remote_nr=([a-zA-Z0-9]+)
    RewriteCond /home/deb34766n29/domains/domain.com/public_html/login/data/new_rewrite/%1-3 -f
    RewriteRule ^(.*)$ - [L]

    ## allow access for product #4
    RewriteCond %{HTTP_COOKIE} amember_remote_nr=([a-zA-Z0-9]+)
    RewriteCond /home/deb34766n29/domains/domain.com/public_html/login/data/new_rewrite/%1-4 -f
    RewriteRule ^(.*)$ - [L]

    ## if user is not authorized, redirect to login page
    RewriteCond %{QUERY_STRING} (.+)
    RewriteRule ^(.*)$ http://www.domain.com/login/?products=3,4&url=%{REQUEST_URI}?%{QUERY_STRING}&referer=%{HTTP_REFERER} [L,R]
    RewriteRule ^(.*)$ http://www.domain.com/login/?products=3,4&url=%{REQUEST_URI}&referer=%{HTTP_REFERER} [L,R]
    ########### AMEMBER FINISH ####################

    Thanks in advance.
    Cheers,
    Aron
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,670
    In your cron job you can specify some custom user agent eg. UserAgent-YOURSECRETTOKEN
    when you trigger cron url and then right after
    RewriteEngine On

    you can add code
    RewriteCond %{HTTP_USER_AGENT} UserAgent-YOURSECRETTOKEN
    RewriteRule ^(.*)$ - [L]

    It should helps.
  3. aronprins

    aronprins aMember Pro Customer

    Joined:
    Sep 1, 2014
    Messages:
    12
    Works like a charm! Thanks so much :)
Thread Status:
Not open for further replies.

Share This Page