For the REST API if it is enabled the documentation states
"When enabled, the built-in Bitcache server is made available at http://drupal/amf/en/bitcache/. Access to the REST API is subject to Drupal authentication and permissions." after enabling the bitache module.

When I click on the link I get "Page not found The requested page could not be found. "

When I load upload a bitstream I get the same message above if I try to access the stream. If I use fileframeowrk, I am also unable to access the uploaded files.

Am I missing something. Should I install REST API and from where. A development version for 5 is available and I am using 6.9.

If I disable REST API I get "Access denied You are not authorized to access this page. "

Please advise

Comments

v8powerage’s picture

Have You managed solve this problem? It seems that I have the same issue: #403960: Page not found errors (2)

Arto’s picture

Title: Page not found The requested page could not be found error when REST API is enabled » Page not found errors
Assigned: Unassigned » Arto
Issue tags: +404, +REST API

@Ali, what is your Drupal root URL? That is, if Bitcache is at http://drupal/amf/en/bitcache/, is your website itself at http://drupal/amf/en/ or at http://drupal/amf/? If it's the latter, I'm thinking the localization might be affecting Bitcache.

@Shaman, you indicated in #403960: Page not found errors (2) a URL that started with http://mysite.com//bitcache/; is it the case that the URL does have two forward slashes in front of bitcache/, or was that a typo?

v8powerage’s picture

That was a mistake, but either way this doesn't works, even when I turn off rest api, then instead 404 I'm getting "You are not authorized to access this page.".

I'll give You the list of the enabled modules and their settings if that's any help:

  • bitcache
  • cck
  • dav
  • fileframework
  • fileserver
  • rdf
  • WebDAV (with installed HTTP_WebDAV_Server-1.0.0RC4.tgz)

Modules' settings:

DAV Settings:(admin/settings/dav)

DAV Server settings

# DAV server:
*enabled

# Allow hidden file/collection creation:
*disabled

# Enable DAV method tracing:
*disabled

DAV client settings:

# DAV client:
*disabled

Data Storage(admin/settings/bitcache)

Server settings

#Bitcache REST API:
*disabled

#Enabled features:
*GET/HEAD
*POST
*PUT
*DELETE

#Download method:
*Passtrough (4k chunks)

#Path to Bitcache executable:
*modules/bitcache/tools/bin/bit - THIS DIRECTORY IS EMPTY

File system(admin/settings/file-system)

#File system path:
*files

#Temporary directory:
*/tmp

File system backend(admin/settings/dav/dav_fs)

File system settings

#DAV file system root:
*files/dav

Files(admin/settings/file)

Visibility settings

#(all checked)

Mime settings

#Server-side MIME type autodetection after upload:
*Disabled

RDF settings(admin/settings/rdf)

Formats

*RDF/JSON application/json Yes Yes

RDF Schema

#RDFS base URI:
*http://mydomain/rdf/schema/

Maintenance

#Prevent duplicate statement insertion:
*Enabled

#Merge duplicate statements on cron runs:
*Enabled

#Purge unused resource URIs on cron runs:
*Enabled

I ommitted:
* Mappings
* Feeds
* Namespaces
* Contexts
* Repositories

Arto’s picture

@Shaman, only the Bitcache settings and permissions are important. Could you post information, please, on how you've configured the permissions at admin/user/permissions#module-bitcache and whether you are accessing as the Drupal superadministrator (user ID 1) or as a regular user with administrative rights.

Also, please consider upgrading to the new versions of Bitcache and File Framework that were released earlier today.

v8powerage’s picture

Permissions are set properly, I'm accessing as an admin with ID 1

When I click view I'm redirected to page with address like this: /bitcache/59c48c7abba4633042e02b955bba56986649189f?vid=8331&disposition=inline&op=view

but instead of image, there is message "Access Denied"

What about this?

#Path to Bitcache executable:
*modules/bitcache/tools/bin/bit - THIS DIRECTORY IS EMPTY

Arto’s picture

@Shaman, you can ignore that setting. As nothing stands out, I suggest trying to upgrade and seeing if that solves the problem.

v8powerage’s picture

So this can work without 'Bitcache executable'?

Arto’s picture

Yes, that is only for special use cases such as e.g. synchronizing repositories to Amazon S3.

v8powerage’s picture

Unfortunately after update it still doesn't works. I can browse file nodes, but each time I try view, or download file, I'm redirected to a page with address like this one: http://mysite/bitcache/59c48c7abba4633042e02b955bba56986649189f?vid=8331&disposition=attachment&op=download with message 'You are not authorized to access this page.'

Tell me, what am I doing wrong? Is anyone made this actually working?

jwalkerbg’s picture

Version: 6.x-1.0-beta1 » 6.x-1.0-beta2

Hello,

I am experiencing similar problem - may be the same problem. As Administrator, I am able to (1) upload files in bitcache streams, (2) to view their metadata, (3) to browse them; but I am not able to download them and to view their content. I receive an almost empty page with a single "403 Forbidden" error. This happens with the newest for the moment versions bitcache 6.x-1.0-beta2 and fileframework 6.x-1.0-alpha4 (http://drupal.org/project/fileframework). I posted at http://drupal.org/node/407018 for that problem. What is more surprising, I am able to download and view files on one site (my laptop) with the same versions of the modules. I compared the installations - they are almost the same.

v8powerage’s picture

jwalkerbg - what do You mean saying the same versions of the modules, which version You are thinking of exactly?

jwalkerbg’s picture

Shaman, the both sites (one on my laptop and another on a Linux machine) have the same set of modules enabled except the View modules are not enabled on the laptop). All the modules are up-to-date -- their most recent versions are installed on both sites.

v8powerage’s picture

jwalkerbg I'm also running Linux, so that's the case of this problem I suppose… Could it be also, that it has something to do with safe_mode enabled on php?

jwalkerbg’s picture

Shaman, I suppose that Linux or Windows do not matter. I will compare both php.ini files (Win vs Linux) to see if there is something different, tomorrow at work, but I am not fluent in PHP. Have You seen reports, may be there is some hint there?

v8powerage’s picture

There's nothing in the logs. I noticed, that when I go to the http://mysite.com/bitcache there's also "Access Denied" message.

I think only Arto can solve this.

jwalkerbg’s picture

Here is what is posted by phow in the other thread about the problem : http://drupal.org/node/407018#comment-1378260

v8powerage’s picture

Unfortunately none of the posted solutions works for me :-(

I started testing this (version beta2), on the different 2 servers and I can't even upload file, because I'm getting those errors:

    * warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an array in 
/htdocs/modules/bitcache/bitcache.module on line 677.
    * warning: array_merge() [function.array-merge]: Argument #1 is not an array in 
/htdocs/modules/bitcache/bitcache.module on line 677.
    * warning: array_merge() [function.array-merge]: Argument #2 is not an array in 
/htdocs/modules/bitcache/bitcache.module on line 677.
    * recoverable fatal error: Argument 1 passed to Bitcache_FileRepository::__construct() must be an array, null given, called in 
/htdocs/modules/bitcache/bitcache.module on line 681 and defined in /htdocs/modules/bitcache/adapters/file.inc on line 13.
    * warning: array_merge() [function.array-merge]: Argument #2 is not an array in 
/htdocs/modules/bitcache/adapters/file.inc on line 21.
    * The directory does not exist.
    * warning: copy() [function.copy]: open_basedir restriction in effect. File(/992a842ae300f3ac40b4880622f510e5c516fdb2) is not within the allowed path(s): (/:/usr/share/php/) in /htdocs/modules/bitcache/adapters/file.inc on line 163.
    * warning: copy(/992a842ae300f3ac40b4880622f510e5c516fdb2) [function.copy]: failed to open stream: Operation not permitted in /htdocs/modules/bitcache/adapters/file.inc on line 163.
    * Error saving file sexbunny2.jpg. Please, contact site administrator.
    * A file upload must be provided.

This one is best: * Error saving file sexbunny2.jpg. Please, contact site administrator. Yup I think I will contact me about this issue.

Did anybody else had the same issue? Can someone help me!?

zemial’s picture

I have same problem with "page not found". Everything was working with alpha2, but since i updated to beta2 and accessing ie. "/en/bitcache/03d569347685c0788574d604dbb732df621ee6fb" it gives a page not found. However if i take the "/en/" out from the link, it will give the correct file. So, something to do with localization?

RedSeo’s picture

the both sites (one on my laptop and another on a LinuxMuhabbet machine) have the same set of modules enabled except the View modules are not enabled on the laptop). All the modules are up-to-date -- their most recent versions are installed on both sites.

Arto’s picture

Guys, access control problems are usually a matter of configuration.

First, check the admin/settings/bitcache screen to ensure that "Bitcache REST API" setting is enabled (which it is by default, after installation), and that the "Enabled features" setting has at least "GET/HEAD" checked (as it is by default).

Then, check the admin/user/permissions screen to ensure that you have granted the "access bitstreams" privilege to the user roles you are testing with.

When in doubt, grant the aforementioned permission to every user role and see if that solves the issue.

As this seems a frequent issue, I will add a section about permissions to INSTALL.txt in the next release.

Arto’s picture

@zemial, your problem is indeed different from the rest of this thread, and specifically related to localization.

I've committed a fix for localization issues today; please try the latest 6.x-1.x-dev snapshot which should solve any localization problems by ensuring that links to Bitcache downloads don't have the language prefix.

(As there are database updates in the latest snapshot, make sure to run update.php before testing.)

v8powerage’s picture

I done everything from #20 but this wouldn't help. I believe the problem in my case is much much more deeper, and it's not that easy to solve (I sent Arto email with my website address, to see on live site what I'm talking about).

I'm getting always this error http://drupal.org/node/408504#comment-1599228

v8powerage’s picture

Priority: Normal » Critical
schnorte’s picture

In my case the "Page not found" error was triggered by a wrong line in bitcache.server.inc in combination with mulit-language-site (localization). every url had a language prefix with is not considered in the url-checks of the function "bitcache_server".

When disabling the REST API, this function triggers the "Access denied" error mentioned above. But a change of these lines, considering that my URLs have a langauge prefix (of a string length 3 including slash) solved the problem.

  // Attempt to dispatch the request to the Bitcache server implementation.
  if (strpos($request, BITCACHE_ALIAS) === 3) {
    $request = substr($request, strlen(BITCACHE_ALIAS) + 3);