OPLON LBL ADC rewrite an http body to clean a value before xml content - reverse-proxy

In the HTTP body, requests and responses, I need to clean a non xml part at the start of body when passing through LBL ADC Reverse Proxy.
The value to clean is XMLDATA= eg.:
Values in the HTTP body before rewriting:
XMLDATA=<myXmlData> ....
...
...
</myXmlData>
Expected values after body rewriting in the HTTP body:
<myXmlData> ....
...
...
</myXmlData>
thanks in advance.

You can use an OPLON LBL ADC body rewrite rule that uses a regular expression to clean a firs part of body response. OPLON LBL ADC is a full reverse proxy and you can inspect or modify REQUEST and RESPONSE, HEADER and BODY.
In this case when the regex rule matches with a start string XMLDATA= the rule replace the content in the all other body data exept the start match frase.
<rewriteBodyRule name="cleanXmlContents" flow="BOTH">
<mimeType value="application/xml" fragmentClose=">" fragmentOpen="<"/>
<regexTag>^XMLDATA\=(.*)</regexTag>
<replaceTo>$1</replaceTo>
</rewriteBodyRule>
Keep in mind! If the HTTP body has compressed by endpoint (app/web server), you need disable the compression for that request to rewrite a body. OPLON LBL ADC compress a data body for you after rewriting...
You have 2 way to disable compression:
1) disable compression in the app/web server
2) disable compression with a rewrite HEADER rule in the REQUEST HTTP header by OPLON LBL ADC.
For case (2) you can use a Template rule in the OPLON LBL ADC.

Related

How do I respond to the Dropbox webhook challenge in Dark?

I want to respond to a Dropbox webhook using my Dark app (https://darklang.com/)
It says I need to set some headers to respond to the challenge (https://www.dropbox.com/developers/reference/webhooks)
How do I even set headers in the response?
The trick is twofold:
You need to set the correct headers. This is tricky in Dark, especially with headers that have a dash in the name
And, you need to pull the 'challenge' out of the URL parameters and then put that in the body of the request. Try this:
let body = request.queryParams.challenge
let headers = Dict::empty
|>Dict::set "Content-Type" "text/plain"
|>Dict::set "X-Content-Type-Options" "nosniff"
let response = Http::respondWithHeaders body headers 200
response

Is it expected behavior that path is reset between requests in a single Scenario?

I'm trying to create a vanilla delete test, and our endpoints check Etags. The proper way to go about this IMHO is:
GET the object & read its etag header
Assign that header to the etag header in a follow up DELETE request
So I have something like this:
Feature: Delete with etag
Background:
* url config.url
* path 'path/to/entity/type'
Scenario: Retrieve Login page url
Given path entityId
When method get
* def etag = responseHeaders['Etag']
Given path entityId
And header Etag = etag
When method delete
Then status = 204
This seems like it should work, but what I'm seeing is that between the two requests the root path set in the Background is reset. Is this expected? It makes sense if the assumption is that if you are making multiple requests within a scenario, the subsequent requests could be to a different url, and resetting the path is necessary to avoid polluting it for the secondary host (since path is append-only).
As a follow-on, this is a pretty common scenario in my experience. Is there a better usage pattern to handle this kind of thing?
Simple, you just shape the "base URL" to match your REST "resource". url will not be re-set. path is.
* url config.url + '/path/to/entity/type'
And now this will work as you expect:
Given path entityId
The Hello World example shows this pattern if you look closely.

Remove FirePHP headers with Varnish

I've got a line in my Varnish default.vcl that successfully clears the ChromePHP headers:
sub vcl_fetch {
remove beresp.http.X-ChromeLogger-Data;
}
I'm trying to do the same thing for FirePHP, but the data for FirePHP is spread out over many headers rather than all in one:
X-Wf-Protocol-1
X-Wf-1-Plugin-1
X-Wf-1-1-1-9
X-Wf-1-1-1-43
etc
How can I tell Varnish to remove any headers that start with "X-Wf-"? I can't find any documentation that includes a wildcard for the header name.
If you can, remove the x-wf-* request headers which will cause the response headers not to be issued. You can hardcode the names of the few request headers.

JMeter save unencoded Request (Sampler) parameters

I've made my test plan and set up samplers, assertions, listeners and so on.
My Http Samplers post XML data to an URL sending a parametrized encoded http request.
In my listeners I'm able to save many info about any sample, but I'm not able to save in the sample information the XML request sent in the request parameter without encoding.
Is there a way to do this?
Update
Here is an example of the exported listener:
<httpSample t="1001" ts="1376663141980" lb="Caso 1 (VI16)" rm="OK" by="648">
<assertionResult>
<name>Response Assertion</name>
<failure>false</failure>
<error>false</error>
</assertionResult>
<responseData class="java.lang.String"><?xml version="1.0" encoding="ISO-8859-1"?> [... the rest of the html encoded response ...]</responseData>
<cookies class="java.lang.String"></cookies>
<method class="java.lang.String">POST</method>
<queryString class="java.lang.String">data=%3CFastBankRichiesta+%3E+%0A%09%3CTestata+NomeMessaggio%3D%22VI16%22+Timestamp%3D%2220130816162541928%22 [... the rest of the URL encoded request ...]</queryString>
</httpSample>
So, the request and the response are encoded, but while the response is correctly html encoded (because I choosed XML export), the request is URL encoded; how to apply decoding back to text and html encoding in order to see request and response correctly with a web browser?

How to pass regular expression extracted value in json format for PUT call in jmeter?

I am testing RESTapi with (json format) using (HTTP Request sampler) in jmeter. I am facing problems with the PUT calls for update operation.
The PUT call with parameters don't work at all using (HTTP Request sampler), so now i am using the post body to pass the Json.
How can i pass the extracted values from the previous response to next PUT request in thread group? Passing the 'Regex veritable' to PUT call in Post body don't work, it doesn't take ${value} in Post body.
How do i carry out UPDATE operations using (HTTP Request sampler) in Jmeter?
Check that your regexp extractor really worked using a debug sampler to show extracted value.
Check your regexp extractor is scoped correctly.
See this configuration:
A Variable:
Its use with a PUT request:
The sampler result: