Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 374331

Summary: Support CORS for cross origin XHR
Product: [ECD] Orion Reporter: John J. Barton <johnjbarton>
Component: ServerAssignee: Project Inbox <orion.server-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: davidleonigit-eclipse
Version: 0.5   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description John J. Barton CLA 2012-03-14 20:46:57 EDT
I want to use the Orion "Site" feature to map git project names into URLs. So I want
  /opm to serve https://johnjbarton@github.com/johnjbarton/opm.git
  /q   to serve https://johnjbarton@github.com/johnjbarton/q.git 
and so on. This means I can have modular source without git submodule junk and I can have useful URLs.

Unfortunately this is not currently possible because there is no way to use Orion API in files served from a "Site". (Well you can use the self-hosting option, but then all of your files have to be under an even more ridiculous URL, eg /Q/bundles/org.eclipse.orion.client.users.ui/web/.) The problem is that Orion exist at say localhost:8080 and the Site feature creates a server at 127.0.0.2. When my app at 127.0.0.2 issues xhr to localhost, the request fails because it is cross domain.

Evidently CORS will fix this; Jetty has a CORS servlet called CrossOriginFilter. So in principle all that is needed is the correct XML in Orion's plugin.xml file. However, this code does *not* work:

<filter>
	<filter-name>cross-origin</filter-name>
	<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
	<init-param>
		<param-name>allowedOrigins</param-name>
		<param-value>*</param-value>
	</init-param>  
</filter>
<filter-mapping>
	<filter-name>cross-origin</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>
Comment 1 John Arthorne CLA 2015-05-05 14:40:45 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:

https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html