Wednesday, April 29

Reverse proxy supported by Web Dynpro

Symptom
Reverse proxy supported by Web Dynpro; generated URLs have changed

Other Terms
WDURLGenerator, reverse proxy, URL generation, absolute URL, relative URL, resource path, Web resource URL, SPS13, Web Dynpro URL generation

Reason and Prerequisites
Starting with NetWeaver04, SPS13, Web Dynpro will support reverse proxies. In prior service packs, reverse proxies were not supported (see also note 711093). The support of reverse proxies led to a change in the URLs generated by the WDURLGenerator: Methods like
WDURLGenerator.getWebResourceURL(...), WDURLGenerator.getApplicationURL(...),
WDURLGenerator.getSAPIconsWebResourcePath(...), etc.

previously generated absolute URLs like the the following:

/webdynpro/resource/sap.com/tc~wd~corecomp/Components/test.TestComp/icon.gif

These URLs couldn't be resolved when a reverse proxy was used. In order to support reverse proxy landscapes, the generated URLs had to be changed to be relative URLs like the following:

../../../resource/sap.com/tc~wd~corecomp/Components/test.TestComp/icon.gif

This change should be transparent for the application if the URL generator is used as supposed. However, there might be problems in an application that misused the URL generation, as shown in the example below:

1. If the application generates Web resource URLs and adds a prefix to     the generated URL:
String url = "~host" + WDURLGenerator.getWebResourceURL(...);
   Previous to the support of reverse proxies, this led to an URL like           ~host/webdynpro/resource/sap.com/tc~wd~corecomp/Components/
          test.TestComp/icon.gif

   Starting with SPS13, this will result in the following wrong URL:
~host../../../resource/sap.com/tc~wd~corecomp/Components/
          test.TestComp/icon.gif

   Solution:
   The prefix should be removed. Using the prefix is no good idea          at all. It makes the application coding dependent on small              changes of the URL generation. The WDURLGenerator is supposed to        contain all methods required to generate URLs on static resources of    Web Dynpro applications and is supposed to hide away any details of     the structure of the generated URL to the application.

No comments:

Post a Comment

You are welcome to express your views here...