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

Bug 492175

Summary: FileDialog doesn't work behind proxy
Product: [RT] RAP Reporter: Christian Hager <christian.hager>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: christian.hager, ingo.meyer, ivan
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/#/c/71880/
Whiteboard:

Description Christian Hager CLA 2016-04-21 09:08:37 EDT
FileUpload doesn't work behind an url rewriting proxy. Looking at the chrome debug tools you can see that the upload fails with error 404 because the upload url is missing the part that is added by the proxy.

For example if I have an EntryPoint named myEntryPoint on my local machine I get an url like http://localhost:<port>/myEntryPoint. Deployed behind the proxy we get an url like http://mydomain.com/url-part-created-by-the-proxy/myEntryPoint. In this case the Upload in the FileDialog fails because it posts to a nonexistent url like http://mydomain.com/myEntryPoint which is missing the url-part added by the proxy.
Comment 1 Ingo Meyer CLA 2016-04-26 11:57:38 EDT
Hi,

I solved this problem in 3.1M5. It is because "RWT.getServiceManager().getServiceHandlerUrl( SERVICE_ID )" is not returning relative path (anymore).
The leading "/" must be removed, so we just hacked ServiceManagerImpl.getServiceHandlerUrl with:

return ContextProvider.getResponse().encodeURL( url.toString().startsWith( "/" ) ? url.toString().substring( 1 ): url.toString() );

and all servlets and file-uploading is working :)

Happy evening
~Ingo
Comment 2 Ivan Furnadjiev CLA 2016-04-26 12:05:26 EDT
The ServiceManagerImpl#getServiceHandlerUrl returns absolute path. See bugs:
437211: getServiceHandlerURL() missing entrypoint-path without cookie support (regression due to Bug#406428)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=437211
and the original bug to make it relative:
406428: ServiceManager#getServiceHandlerUrl should return relative URLs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=406428
Now I don't know how to fix the implementation in order to cover both cases.
Comment 3 Christian Hager CLA 2016-04-27 02:06:25 EDT
Looks like this should be made configurable as suggested in Bug#437211
Comment 4 Ingo Meyer CLA 2016-04-27 02:10:32 EDT
Hi Ivan,

I agree with Christian. It should be configurableand absolute URLS can be the default.
Comment 5 Ivan Furnadjiev CLA 2016-05-03 11:06:51 EDT
Add support for configurable system property "org.eclipse.rap.rwt.serviceHandlerBaseURL" with change https://git.eclipse.org/r/#/c/71880/.