Forum Discussion
ML_108504
Nimbostratus
Apr 22, 2009HTTP::respond question on content
I'm attempting to compose an iRule where the F5 will respond with a standard JBoss 404 if there's a match to certain URIs.
I have two issues.
1. I want to insert the requested URI into the HTTP::respond content section, using the HTTP::uri command. Is this feasible? Do I need to use escape characters in order to use HTTP:: commands (or variables for that matter) inside of a HTTP::respond content section?
The code below just treats [HTTP::uri] as a text string.
HTTP::respond 404 content {JBossWeb/2.0.1.GA - Error report HTTP Status 404 - [HTTP::uri]type Status reportmessage [HTTP::uri]description The requested resource ([HTTP::uri]) is not available.JBossWeb/2.0.1.GA} noserver
2. This HTTP::respond command passes the following to the client, and I don't want the Connection and Content-Length headers passed this way. I'm not doing this explicitly, how can I prevent these two lines from appearing? I just want the section to be passed to the client, with the [HTTP::uri] value passed by the client.
Connection: Keep-Alive
Content-Length: 979
JBossWeb/2.0.1.GA - Error report HTTP Status 404 - [HTTP::uri]type Status reportmessage [HTTP::uri]description The requested resource ([HTTP::uri]) is not available.JBossWeb/2.0.1.GA
- hoolio
Cirrostratus
The outermost curly braces prevent variable expansion/interpretation of commands in TCL. You should be able to use subst (Click here) to force evaluation of the [HTTP::uri] command within the curly braces: - ML_108504
Nimbostratus
Ah. That answers both my questions. Good stuff to know. Hmmm, too bad about the 2nd point. - spark_86682Historic F5 AccountIf you really don't want the headers there, you could probably use TCP::respond instead.
- hoolio
Cirrostratus
Good point on TCP::respond. I'm just not sure what kind of client would handle data coming back with no Content-Length or Connection header. It seems like you would need at least one or the other for the client to accept the response. - ML_108504
Nimbostratus
Hi guys, just to clarify: - hoolio
Cirrostratus
Can you try testing without the noserver flag? Which version are you testing this on?
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects