cancel
Showing results for 
Search instead for 
Did you mean: 

ICM rewrite rule - SetHeader UserAgent

martin_E
Active Contributor
0 Kudos

According to the SAP help Manipulating Header Fields - SAP Web Dispatcher - SAP Library, I can manipulate Web browser header fields.


is there a list of the valid header field names ? In particular, I want to modify the UserAent field.  SAP help file says that the field names are case-sensitive, so if I wanted to manipulate the User Agent, do I specify

User-Agent

UserAgent

userAgent

USERAGENT

or am I limited to fields specified in the help ...

clientProtocol

X-SAP-WEBDISP-AP

Referer

I know the capabilities of ICM rewriting rules has evolved over the releases (for an example of this, see https://launchpad.support.sap.com/#/notes/0002042819). Does anyone know of a list of these changes over time ?


thanks

Accepted Solutions (1)

Accepted Solutions (1)

cris_hansen
Advisor
Advisor
0 Kudos

Hello Martin,

I must confess: I was really curious about the string I should use to set the user agent...

Well, I decided to test.

First, I recalled that I wrote some blog posts about SSO recently. And I used the icm trace file to check some information. Not of my concern at that time, but I clearly saw the rewriting handler in action (not doing nothing, actually - as I didn't define icm/HTTP/mod_0):

"...

[Thr 3852]   GET /sap/bc/gui/sap/its/webgui HTTP/1.1

[Thr 3852]   accept: text/html, application/xhtml+xml, */*

[Thr 3852]   user-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

[Thr 3852]   accept-encoding: gzip, deflate, peerdist

...

[Thr 3852] HTTP request (rewritten) [4/2944/1]:

[Thr 3852]   GET /sap/bc/gui/sap/its/webgui HTTP/1.1

[Thr 3852]   accept: text/html, application/xhtml+xml, */*

[Thr 3852]   user-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

[Thr 3852]   accept-encoding: gzip, deflate, peerdist

..."

I decided to test: "user-agent" as <name>.

In my icm_filter_rules.txt file I just put:

SetHeader user-agent "MyWebBrowser/11.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"

and started my test web dispatcher (faster than restarting an ABAP test system).

dev_webdisp brought me the results:

"...

[Thr 13772] HTTP request (raw) [1/13/1]:

[Thr 13772]   GET /sap/bc/gui/sap/its/webgui HTTP/1.1

[Thr 13772]   accept: text/html, application/xhtml+xml, */*

[Thr 13772]   user-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

...

[Thr 13772] HttpModExecuteHRule: check conditions for HeaderRule [0] "SetHeader user-agent MyWebBrowser/11.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"

[Thr 13772] HttpModExecuteHRule: conditions for HeaderRule "SetHeader user-agent MyWebBrowser/11.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko" are TRUE

[Thr 13772] HttpModExecuteHRule: set header field: user-agent -> MyWebBrowser/11.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

[Thr 13772] HttpModExecuteOps: pattern of operation matched, flags=4

...

[Thr 13772] HTTP request (rewritten) [1/13/1]:

[Thr 13772]   GET /sap/bc/gui/sap/its/webgui HTTP/1.1

[Thr 13772]   accept: text/html, application/xhtml+xml, */*

...

[Thr 13772]   user-agent: MyWebBrowser/11.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

..."

So, answering at your first question: no, you are not limited to the examples given in the SAP help page. I don't know, however, a document with a list of valid header names. I assume that, as long as you can find a header name in the trace file, this might be modified. I would also say that you can also create your own names/values (if you have a particular reasoning for that).

Coming to your question about keeping track of changes - I also don't know any document of that.

Maybe one indication would be the "Release notes" button in SMICM? In my ABAP test system with kernel 7.42 pl 400, I found a list of 146 notes. Of course, not all the list is related to header manipulation (only 7 of them contain the "header" text in the note description).

I hope this helps,

Cris

martin_E
Active Contributor
0 Kudos

Hi Cris,

thanks very much for that. I wil lalso have a look at the rest of your blogs

Martin

Answers (0)