cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping a URL-suffix with sapwebdispatcher

heiko_feisel
Explorer
0 Kudos

Hi together,

we're searching for a solution to mapp an requested URL (portalhost.olddomain.de) to an new URL (portalhost.newdomain.de).

If the requestet URL has an prefix like /irj/portal it should not be changed.

Is such a scenario possible with the sapwebdispatcher or do anybody now how I can solve this situation?

Thanks,

Heiko

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello Heiko,

At what point in time do you want to apply the mapping? When the request is incoming from the client, or when a response is created from the back-end and the response contains old URLs?

The first option is possible with Web Dispatcher using the modification handler icm/HTTP/mod_0.

The latter is not possible with Web Dispatcher because it is not able to modify responses. In that case, you could use Apache Http Server as reverse proxy and make use of module mod_substitute.

Best,

Tobias

heiko_feisel
Explorer
0 Kudos

Hi Tobias,

the first option is that what we want.

Can you explain me how it works with  icm/HTTP/mod_x in my case?

I can't find a syntax in the documentation for my problem.

Thanks a lot,

Heiko

0 Kudos

Hello Heiko,

The SAP Web Dispatcher documentation has the chapter "Modifications of HTTP Requests":

http://help.sap.com/saphelp_nw73/helpdata/en/48/9266acaa6b17cee10000000a421937/frameset.htm

Your rule would probably look similar to this:

if %{HTTP_HOST} regimatch portalhost.olddomain.de [and]

if %{PATH_TRANSLATED} !regimatch ^/irj/portal

   RegIRedirectUrl ^/(.*) http://portalhost.newdomain.de/$1 [CODE=permanent]

Good luck!

Tobias

heiko_feisel
Explorer
0 Kudos

Hell Tobias,

thanks for the syntax but it don't work.

In the profile of the sapwebdispatcher I set:

icm/HTTP/mod_0 = PREFIX=/, FILE=/sapmnt/><SID>/profile/icm_rules.txt

I can't find the parameter in the Webdispatcher-Administration.

I expect that the URL which is shown in the broswer wil switch to the new domain URL.

Am I right in this guess?

Heiko

0 Kudos

Hello Heiko,

Did you restart Web Dispatcher after adding the line to its profile? You should see the rules in the Web Admin, otherwise they are not active. You also have to restart Web Dispatcher each time you make a change to the rule file.

You can check the trace dev_webdisp for errors during startup. Maybe it helps to add

rdisp/TRACE=3

to the profile before starting Web Dispatcher. This will set the trace to level 3, even at startup. The modification handler is initialized only at startup.

If the redirect works, the browser will show the new domain URL.

Tobias

heiko_feisel
Explorer
0 Kudos

OK,

I don't know why, but now it works nearly.

I can see the rule in the Web Admin now.

Now if I send a request on http://host.olddomain.de:54400/ it will redirect to http://host.newdomain.de:54400/ but it dosn't work with /irj/portal!

Do I have to change the PREFIX - parameter in the profile?

Or is there a mistake in the rule?

I feel, the solution is near!

Heiko

0 Kudos

No, the PREFIX is okay.

What do you mean with it doesn't work with /irj/portal? Even for /irj/portal there will be a redirect? Can you give a complete examle URL which does not work?

Tobias

heiko_feisel
Explorer
0 Kudos

The redirect from http://host.olddomain.de:54400/irj/portal to http://host.newdomain.de:54400/irj/portal has not worked. All other links like ../irj worked.

So I add a slash to the following line in the rule file:

if %{PATH_TRANSLATED} !regimatch ^/irj/portal/

An now, it works fine!

Thanks a lot!

Bye,

Heiko

Answers (0)