Score:0

socat, request with specific domain

cn flag

I am using socat for redirecting from localhost:6666 to SERVER_DOMAIN:443 because app is not possible make request via SSL.

socat TCP-LISTEN:6666,reuseaddr,fork SSL:SERVER_DOMAIN:443,verify=0

But request is not accepted by receiving server because wrong host DOMAIN in header of request - localhost:6666, I need for example my.domain.com.

2021/08/02 13:47:22 [error] 99#99: *20351099 open() "/etc/nginx/default-webroot/api/transaction.xml" failed (2: No such file or directory), client: CLIENT, server: SERVER_DOMAIN, request: "GET /api/transaction.xml HTTP/1.1", host: "localhost:6666"

Need specific domain in header.

Is possible run socat with parameters for request with header "host: SOME_DOMAIN"?

Thanks.

in flag
That would require socat to understand HTTP. You should consider to use a reverse proxy instead, e.g. mitmproxy can run in this mode. A proxy understands HTTP and thus can adapt the header field.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.