What’s the de facto standard for a Reverse Proxy to tell the backend SSL is used?

The proxy can add extra (or overwrite) headers to requests it receives and passes through to the back-end. These can be used to communicate information to the back-end. So far I’ve seen a couple used for forcing the use of https in URL scheme: X-Forwarded-Protocol: https X-Forwarded-Ssl: on X-Url-Scheme: https And wikipedia also mentions: # … Read more

How to get host name with port from a http or https request

You can use HttpServletRequest.getScheme() to retrieve either “http” or “https”. Using it along with HttpServletRequest.getServerName() should be enough to rebuild the portion of the URL you need. You don’t need to explicitly put the port in the URL if you’re using the standard ones (80 for http and 443 for https). Edit: If your servlet … Read more

Does the order of headers in an HTTP response ever matter?

No, it does not matter for headers with different names. See RFC 2616, section 4.2: The order in which header fields with differing field names are received is not significant. However, it is “good practice” to send general-header fields first, followed by request-header or response- header fields, and ending with the entity-header fields. It DOES … Read more

Header parameters: “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. 3.1.1.5. 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

What are Content-Language and Accept-Language?

Content-Language, an entity header, is used to describe the language(s) intended for the audience, so that it allows a user to differentiate according to the users’ own preferred language. Entity headers are used in both, HTTP requests and responses.1 Accept-Language, a request HTTP header, advertises which languages the client is able to understand, and which … Read more

tech