I am making an API for an app (using golang) that will be consumed by different clients. I would know if there is any way to know the domain of the client that is doing the request.
Thank you very much.
The http.Request contains a RemoteAddr field which should provide the information you seek.
you can get it in RemoteAddr string field in http.Request
RemoteAddr allows HTTP servers and other software to record the
network address that sent the request, usually for logging. This field
is not filled in by ReadRequest and has no defined format. The HTTP
server in this package sets RemoteAddr to an "IP:port" address before
invoking a handler.
This field is ignored by the HTTP client
Related
According to the documentation of the HTTP OPTIONS method, one can check the communication options of an entire web server, assuming the server supports such a check. My understanding is that one needs to make an HTTP request to the server to be checked with the first line of the request being OPTIONS * HTTP/1.1. How can one make such a request with a common HTTP client? I wasn't able do it with the Postman client or the Requests HTTP client library for Python. Specifically, specifying the asterisk * along with the server's location, http://<host>/*, for example, didn't work.
When a web server receives a http(s) GET request from a client, it has access to some information such as:
The client IP
The request itself :
the headers (including the cookies)
the content
and... that's all ?
I am wondering if there is something else.
Indeed, I am trying to make a server that can access to a page where it can collect some information to update its database. The site denied access to my server but not to web browsers, even if I replicate the IP, the headers and the content.
Thanks for your help.
Yes, it's only what is contained in the request itself. The server cannot reach back to the client to "pull" information, it only has the information contained in the HTTP request and the underlying TCP/IP packet. That's:
the requesting IP address
the HTTP headers, including requested URL and HTTP method
the HTTP request body, if any
if it's HTTPS, any data exchanged during the TLS handshake, which is usually not very relevant for identifying anything significant
All of that information is voluntarily provided by the requesting client.
Can the HTTP client send a request while receiving the HTTP response?
For example, a client sends HTTP request A to server. Then, the server starts to send HTTP response. Before the client finish to receive HTTP response A, the client sends additional request B. Can it be possible? or Does it follow the HTTP RFC?
I think that above scenario is different from the pipelining. What I know about the pipelining is the scenario that client send multiple request A,B,C then the server response A,B,C consecutively. However, in the above scenario, request B is issued while the processing the response A.
Thank you
With the same connection object you must read the whole response before you can send a new request to the server, because response provides access to the request headers, return type and the entity body, If you send new request before fully reading response, client may get confused with mismatched responses.
Again it totally depends upon client library you using. Library could allow asynchronous requests.
There are concepts like
AsyncTask in android, promis in Angularjs etc.
allow asynchronous request.
I'm using mule esb 3.7.1 with the latest HTTP connector. I have a flow with an incoming http connector; and need to know which IP addresses are sending requests.
I have mmc etc - what's the easiest way to do this?
Have looked at the all the docs afaik and see no mention.
Use the below logger statement to print the request IP address after HTTP inbound component
<logger doc:name="Logger" level="INFO" message="IP value --- #[message.inboundProperties.'http.remote.address']"></logger>
The HTTP header property "http.remote.address" of the Mule message lets you identify the remote host for a HTTP request.
But you need to consider these:
1) In a typical client environment, the request calls may be routed from firewalls, reverse proxies etc and may reach Mule. In that case, the above HTTP header property might have your reverse Proxy IP address (you need to confirm this by testing this in a test environment)
2) If you want to monitor the http requests from different client IPs/hosts, then you need to use an external tool and route the calls to Mule (i.e. a front ending Load Balancer kind of tool which provides you these details).
Hope this helps!
Thank you,
Ananth Krishnan
www.app-integrators.com
I have a BizTalk 2010 project containing an orchestration that needs to make an HTTP Post and then examine the Status Code and Body of the Response to determine the next course of action.
I can configure the orchestration and port to make the HTTP Post, but I am unable to receive a response.
Should I be using a send / receive port or correlation?
What schema should I be using for the response (I believe the response is the standard http response: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6).
If you are looking for a kind of notification ( not in content of the message) that the message has been successfully transmitted, you can set the logical send port property in the orchestration as follows:
"Delivery Notification" = Transmitted
And delivery failures can be handled using the Microsoft.XLANGs.BaseTypes.DeliveryFailureException
The Http Status Code should be available on the Response message as a Context Property, which you can access in an Expression shape.
statusCode = ResponseMessage(HTTP.ResponseStatusCode);
Your ResponseMessage should be of type System.Xml.XmlDocument, but as it won't be a real Xml Document, make sure the Request/Response port is configured to use the PassThruReceive pipeline on the Response side.