Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360274 - [sites] Some APIs giving errors on self hosted site
Summary: [sites] Some APIs giving errors on self hosted site
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.3   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 0.3 RC2   Edit
Assignee: Mark Macdonald CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 359609 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-07 15:24 EDT by Mark Macdonald CLA
Modified: 2011-10-13 09:14 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Macdonald CLA 2011-10-07 15:24:36 EDT
Global search (Ctrl+H) from the editor does not work:
  Error: Unable to load http://localhost:8080/filesearch?q=siteEditorTable status:0


The User Profile page shows an error where the OpenId logins should appear:
 { "HttpCode": 404,
   "Message": "File not found: /Cv/bundles/org.eclipse.orion.client.users.ui/web/mixlogin/manageopenids",
   "Severity": "Error",
   "Code": 0
 } {
   "HttpCode": 404,
   "Message": "File not found: /mark.orion.eclipse.org/mixlogin/manageopenids",
   "Severity": "Error",
   "Code": 0
 }


The git-log page loads, but I see errors in the console:
 OPTIONS http://localhost:8080/gitapi/clone/file/Cv/ 405 (Method Not Allowed)
 XMLHttpRequest cannot load http://localhost:8080/gitapi/clone/file/Cv/. Origin http://mark.orion.eclipse.org is not allowed by Access-Control-Allow-Origin.
Comment 1 Mark Macdonald CLA 2011-10-11 10:40:16 EDT
The access-control error is due to several places that return Task resources with an unexpected URL format:
> {
>   "Id": "AGcjkRL0ABAQAeLMpxFpfQ",
>   "Location": "http://localhost:8080/task/id/AGcjkRL0ABAQAeLMpxFpfQ",
> ... }

The URL should be /task/id/AGcjkRL0ABAQAeLMpxFpfQ otherwise the inner site can't deal with it.
Comment 2 Mark Macdonald CLA 2011-10-11 14:44:32 EDT
(In reply to comment #1)
I fixed some of this, but there is another problem with the URL-rewriting magic done by the server and the Task API.

Just before writing the response body, the server strips off host, port, scheme from URLs to produce relative URLs required for the inner site's XHR calls to work. The code that does this expects a JSON object containing typed URI objects (sigh).

Anything passing through the TaskService gets serialized to JSON and reparsed. When writing a Task result, the URI types are already gone, and we don't attempt to rewrite URLs inside plain strings.
Comment 3 Mark Macdonald CLA 2011-10-11 15:59:28 EDT
New problem: /images/none.png is 404ing, which produces a funny border around sprited icons.
Comment 4 Mark Macdonald CLA 2011-10-13 01:15:49 EDT
(In reply to comment #2)
URLs are now parsed out of string values encountered in OrionServlet.writeJSONResponse(), and made relative if possible. I had to exclude the Site Configuration servlet from this, as otherwise the server would rewrite the contents of a self-hosting configuration and wreck it when you're running on localhost (eg. "http://localhost:8080/file" would become "/file" which gets interpreted as a project reference).

This should fix all the Git features under self hosting.
Comment 6 Mark Macdonald CLA 2011-10-13 09:14:50 EDT
*** Bug 359609 has been marked as a duplicate of this bug. ***