Hi,
in my server setup I use iptables to set the source ip address of my
outgoing client requests
from a fake ip adresse to the correct one.
The remote service requires the domain name (example.com) as http-header
host field,
and some extra http-header fields.
Well, I decided to use an interceptor:
public class HttpHeaderInterceptor extends
AbstractPhaseInterceptor<Message> {
private String userId;
private String xAuthorizeRoles;
private String host;
public HttpHeaderInterceptor() {
super(Phase.POST_PROTOCOL);
}
@Override
public void handleMessage(Message message) throws Fault {
Map<String, List> headers = (Map<String, List>)
message.get(Message.PROTOCOL_HEADERS);
try {
headers.put("Host", Collections.singletonList(host));
headers.put("USERID", Collections.singletonList(userId));
headers.put("X-AUTHORIZE-roles",
Collections.singletonList(xAuthorizeRoles));
} catch (Exception ce) {
throw new Fault(ce);
}
}
A tcpdump shows that the header field host doesn’t contains the domain
name, but the other fields
are set correctly.
I tried different phases to add my interceptor into the outgoing chain,
without success.
Is there a possibility to set the http-header field host, if yes on
which phase
I have to set it?
Thanks, Alex