cancel
Showing results for 
Search instead for 
Did you mean: 

WebDispatcher - Restrict Access via ModFile

Private_Member_19084
Active Contributor
0 Kudos

Hi experts,

I use the modification rule to limit the access of our websites.

Therefore I made the following entries:

if %{HTTP_HOST} regimatch www.dummy.com [and]

if %{PATH} regimatch "^/sap/*"

SetHeader x-sap-webdisp-target-sid <SID> [break]

This means, that just www.dummy.com/sap/* pages are allowed.

So, but we also use to redirect www.dummy.com to www.dummy.com/sap/*.

But this redirect seams to happen after the modification file, so after the rule.

Because the www.dummy.com is now blocked.

So how can I now achieve, that also www.dummy.com is allowed.

BUT! Just www.dummy.com without any directlink at the end.

Because if I also add e.g.

if %{HTTP_HOST} regimatch www.dummy.com [and]

if %{PATH} regimatch "^/"

SetHeader x-sap-webdisp-target-sid <SID> [break]

Everything is unlocked again (www.dummy.com/<every page>.

Thanks for help

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Christian,

Why not just use a redirect rule similar to the one mentioned in the documentation:

RegRedirectUrl / http://server.domain:8080/default.html [CODE=permanent]

Source:

Redirecting URLs - SAP Web Dispatcher - SAP Library

Best,

Tobias

Private_Member_19084
Active Contributor
0 Kudos

hey, this sounds very good, I will try it.

I will give you response.

Thank you for fast help )

Private_Member_19084
Active Contributor
0 Kudos

I tried the following, but does not really work

In the modification file I entered (just an example!)

if %{HTTP_HOST} regimatch wwwx.*

RegRedirectUrl / http://wwwx.<domain>/z_service [CODE=permanent]

if %{HTTP_HOST} regimatch wwwx.* [and]

if %{PATH} regimatch "^/z_service*"

SetHeader x-sap-webdisp-target-sid <SID> [break]

So in my opinion, it should now work like this.

The first step if a request for wwwx.<domain> is coming, it will modify the url to wwwx.<domain>/z_service.

So the next step is, that just for wwwx* the /z_service services are allowed.

So it should be ok and the SID should be set.

But it is not working.

Do you have an idea whats my mistake?

Private_Member_19084
Active Contributor
0 Kudos

May it be, that only / in (regredirecturl / ...) does not mean redirecting for www.<domain>; ???

Private_Member_19084
Active Contributor
0 Kudos

I think / is redirecting everything....

But so I get an redirecting-error.

Private_Member_19084
Active Contributor
0 Kudos

Seems to be solved now.

I have to use ^/$ instead of just /.

So it is really just for www.domain/ pages.

0 Kudos

Hi Christian,

Just for reference:

Pattern matching is used for operator "regimatch". That's why you need the ^$ to delimit the pattern.

For exact string comparison, you could use the operator "strcmp/stricmp", e.g. the following would work as expected:

if %{PATH} strcmp "/"

RegRedirectUrl and RegRewriteUrl always work with pattern matching (that's why they are called "Reg"), so the example I quoted earlier from the documentation is actually wrong

It should also be:

RegRedirectUrl ^/$ http://...

Best,

Tobias

Answers (0)