Difference between X-Forwarded-For and X-Real-IP headers

What is the difference between these headers? Did you check the $proxy_add_x_forwarded_for variable documentation? the X-Forwarded-For client request header field with the $remote_addr variable appended to it, separated by a comma. If the X-Forwarded-For field is not present in the client request header, the $proxy_add_x_forwarded_for variable is equal to the $remote_addr variable. If the incoming … Read more

Chunked encoding and content-length header

No: “Messages MUST NOT include both a Content-Length header field and a non-identity transfer-coding. If the message does include a non-identity transfer-coding, the Content-Length MUST be ignored.” (RFC 2616, Section 4.4) And no, you can use Content-Length and stream; the protocol doesn’t constrain how your implementation works.

POST binary file with cmd line curl using headers contained in the file

Use curl –header “Content-Type:application/octet-stream” –trace-ascii debugdump.txt –data-binary @asdf.file http://server:1234/url Or Install wireshark or fiddler in windows to see the http request that flows over the network. check the headers and the values being sent. Curl adds few headers by default. These default headers may be incompatible/not-accepted by the http server you connect to in case … Read more

oauth2.0 how to pass access token

With OAuth, the token is generally passed in the request headers. You may wish to try something similar to the following, for both POST or GET: POST: curl http://api.localhost/write -H ‘Authorization: Bearer ACCESS_TOKEN’ GET: curl http://api.localhost/read -H ‘Authorization: Bearer ACCESS_TOKEN’ The value part of the Authorization key/value pair can vary by REST service provider. With … Read more

How to make XMLHttpRequest cross-domain withCredentials, HTTP Authorization (CORS)?

I’ve written an article with a complete CORS setup. I found several issues that can result in this problem: The Access-Control-Allow-Origin cannot be a wildcard if credentials are being used. It’s easiest just to copy the Origin header of the request to this field. It’s entirely unclear why the standard would disallow a wildcard. Firefox … Read more

In which layer is HTTP in the OSI model?

In which layer is HTTP in the OSI model? It’s in the application layer. See the following quotes from the RFC 7230, one of the documents that currently defines the HTTP/1.1 protocol: The Hypertext Transfer Protocol (HTTP) is a stateless application-level request/response protocol that uses extensible semantics and self-descriptive message payloads for flexible interaction with … Read more

MIME type for msgpack?

From Wikipedia : According to RFC 6838 (published in January 2013 : https://www.rfc-editor.org/rfc/rfc6838), any use of types in the “x.” tree is strongly discouraged. Media types with names beginning with “x-” are no longer considered to be members of this tree since January 2013. Then use directly application/msgpack

content-length when using http compression

It depends on the Content-Encoding. RFC 2616 has this to say (amongst other things) about Content-Length: Applications SHOULD use this field to indicate the transfer-length of the message-body, unless this is prohibited by the rules in section 4.4. So we have to figure out what transfer-length is; Section 4.4 (Message Length) says these two things … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)