Does it make sense to have max-age and s-maxage in the Cache-Control HTTP header?

From HTTP Header Field Definitions: 14.9.3 Modifications of the Basic Expiration Mechanism … s-maxage If a response includes an s-maxage directive, then for a shared cache (but not for a private cache), the maximum age specified by this directive overrides the maximum age specified by either the max-age directive or the Expires header. … Note, … Read more

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

X-Cache Header Explanation

CDN (Content Delivery Network) adds X-cache header to HTTP Response. X-cache:HIT means that your request was served by CDN, not origin servers. CDN is a special network designed to cache content, so that usr request served faster + to unload origin servers.

HTTP headers “Accept” and “Content-Type” in a REST context

The difference can be found in the specifications, in this case RFC 7231: 5.3.2. Accept The “Accept” header field can be used by user agents to specify response media types that are acceptable. Content-Type The “Content-Type” header field indicates the media type of the associated representation The Accept header always indicates what kind of … Read more

Set Content-Type to application/json in jsp file

You can do via Page directive. For example: <%@ page language=”java” contentType=”application/json; charset=UTF-8″ pageEncoding=”UTF-8″%> contentType=”mimeType [ ;charset=characterSet ]” | “text/html;charset=ISO-8859-1” The MIME type and character encoding the JSP file uses for the response it sends to the client. You can use any MIME type or character set that are valid for the JSP container. The … Read more

Set ‘Content-Type’ header using RestSharp

The solution provided on my blog is not tested beyond version 1.02 of RestSharp. If you submit a comment on my answer with your specific issue with my solution, I can update it. var client = new RestClient(“”); var request = new RestRequest(); request.Method = Method.POST; request.AddHeader(“Accept”, “application/json”); request.Parameters.Clear(); request.AddParameter(“application/json”, strJSONContent, ParameterType.RequestBody); var response = … Read more