Resource Hints - What is Preload, Prefetch, and Preconnect?[转]

Today we are going to explore current resource hints and directives which can be another great way to boost the performance on your website or web application. You might have heard of preload, prefetch, and preconnect, but we want to dive deeper into the differences between them how you can benefit from them. Some of the advantages of these is that they allow web developers to optimize delivery of resources, reduce round trips, and fetch resources to deliver content faster while a user is browsing a page.

"Resource Hints - What is Preload, Prefetch, and Preconnect?[转]"继续阅读

X-Real-IP 与 X-Forwarded-For

一、X-Real-IP

从字面看 X-Real-IP 代表的是客户端请求真实的 IP 地址,这个参数没有相关标准规范,如果是直接访问的请求,可能是客户端真实的 IP 地址,但是中间若经过了层层的代理,就是最后一层代理的 IP 地址。

Nginx 中的配置

proxy_set_header    X-Real-IP $remote_addr;

"X-Real-IP 与 X-Forwarded-For"继续阅读

HTTP 跨域时的 options 请求[转]

一、简介

出于安全考虑,并不是所有域名访问后端服务都可以。其实在正式跨域之前,浏览器会根据需要发起一次预检(也就是 options 请求),用来让服务端返回允许的方法(如 GET、POST),被跨域访问的 Origin(来源或者域),还有是否需要 Credentials(认证信息)等。那么浏览器在什么情况下能预检呢?

"HTTP 跨域时的 options 请求[转]"继续阅读