Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Access a fisheye raw file from confluence using in-page javascript

metan June 22, 2013

Hi;

I want to access/read the content of a fisheye raw file using an external javascript which runs inside a confluence page so i can give code samples in my documentation.

While I can access the raw file using the browser, it can not be read inside the js. Do you know why?

I've tried my js script by serving a file from an external apache instance and it works. Where as it can not read the raw file that is served by fisheye.

I've thought it could be an issue with CORS support but i can not be able to find how to enable CORS in fisheye / crucible. Any helps are highly appreciated.

Please consider following while answering this question:

  1. Raw file settings are "insecure" in fisheye-crucible.
  2. Accessing the raw file using this path pattern "http://<fisheye-url-and-context>/browse/~raw,r=<revision-number>/<repository-name>/<full-file-path>"
  3. it is a .java file.
  4. Both fisheye-crucible and confluence runs on the same server with default installation configuration and it is win 8 server.
  5. Fisheye-crucible ver: 2.10, confluence ver: 4.3.7

1 answer

1 accepted

1 vote
Answer accepted
rstephens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2013

Hi Metan,

What you're seeing is probably due to lack of CORS support. Unfortunately there is no way to enable CORS in FishEye/Crucible. One way you could work around the lack of CORS is to configure an Apahce (or similar) reverse proxy to serve Confluence and FishEye from the same host/port (with separate context paths)

Kind Regards,
Richard Stephens

metan June 23, 2013

Hi Richard;

Should I serve both FishEye and Confluence from the same apache instance or just Fisheye would be enough?

rstephens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2013

Hi Metan,

To work around the lack of CORS, the Confluence instance would need to be accessing a Fisheye instance on the same host and port. So yes - you would need to proxy both Fisheye and Confluence from the same apache instance.

An alternative approach often implemented by plugin developers (including plugins developed within Atlassian) is to add a servlet or REST endpoint to your Confluence plugin that proxies the request to Fisheye.

Kind Regards,

Richard Stephens

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events