Setting up cron fails

This is the error report:


INIT
Querying Piwik API at: http://piwik.example.org/index.php
Running Piwik 1.10.1 as Super User: Marbot
ERROR: The Piwik URL http://piwik.example.org/index.php does not seem to be pointing to a Piwik server. Response was '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>401 Authorization Required</TITLE>
</HEAD><BODY>
<H1>Authorization Required</H1>
This server could not verify that you
are authorized to access the document
requested.  Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.<P>
</BODY></HTML>'.

How do I provide the credentials? Help is most welcome. Cheers

Cron does not handle HTTP_AUTH authentication at this stage

Thank you for your reply.

If you have added authentication through .htaccess you could try something like this: (untested)

Require valid-user
Allow from 127.0.0.1
Satisfy Any

http://httpd.apache.org/docs/2.0/mod/core.html#satisfy

That way, everybody has to login except localhost.

Thank you for the tip. Just by reading the instructions on apache.org I would believe that this should work. However, reality is different. This setting allows everybody to access the login page for Piwik. :frowning:

Hmm, a quick test in a directory with such an .htaccess file works for me:


AuthType Basic
  AuthName "Restricted"
  AuthUserFile .passwd
  Require user test
  Order allow,deny
  Allow from 127.0.0.1
  Satisfy any

If I access 127.0.01, I can access the folder. If I access the IP, I am asked for a password. Should work.

Other idea:
Create a second instance of piwik but bind it only to localhost.
<VirtualHost 127.0.0.1:80>

Btw. this might be interesting for you too in that regard:
http://forum.piwik.org/read.php?2,99506

Sadly, this does not work. I still get the authorisation error from cron. I cannot really believe that I should be the only one who is trying to set up piwik with access authorisation. However, it seems to be like it.

Hi Marbot, you’re not the only one who is using piwik with access authorisation! :slight_smile:

I don’t know if you’re still trying to solve this problem, but the following worked for me:

Restrict outside access

AuthGroupFile /dev/null
AuthType Basic
AuthUserFile /path/to/user/.htpasswd/public_html/stats/.htpasswd
AuthName “name”

<Files “*”>
Require valid-user

In order to run archive.php as a cron job:

<Files “*”>
Order allow,deny
Allow from x.x.x.x #IP address of your server
Satisfy any

It’s important to have this after the previous rule.

<Files ~ “^piwik.(js|php)|robots.txt$”>
Allow from all
Satisfy any

I’ve tried 127.0.0.1, and that didn’t work. Then I’ve changed it to the actual IP address of the server, and now it works.