单独打开某个网站的配置文件,在server中修改,例如我让某个网站ios目录下的plist文件显示为text/plain格式。 location ~ .*/ios/.*\.plist$ { add_header Content-Type text/plain;} 让某个目录下的文件都显示为text/plain格式。 # Target codelocation /code/ { # All files in it location ~* { add_he...
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain; charset=utf-...
用于http,server,location模块 30.large_client_header_buffers 语法:large_client_header_buffers number size 默认值:large_client_header_buffers 4 4k/8k 功能:指定客户点一些比较大的请求头使用的缓冲区数量和大小。请求头行不能够大于一个缓存的大小。如果客户端发送了一个较大的头,Nginx将会返回“Request URI ...
add_header Access-Control-Allow-Headers"Cookie,Set-Cookie,Origin,X-Requested-With,token,authorization,Accept,Content-type"; add_header Access-Control-Allow-Credentials"true"; add_header Content-Type"text/plain; charset=utf-8"; add_header Content-Length0; return204; } } } 以下为有ssl请求转发 ...
location/browsertest/{add_header Content-Type text/plain;#ancient_browser_value0;modern_browser safari600.0.0;ancient_browser safari;if($ancient_browser){#return301/indextest/1.txt;}return200$modern_browser,$ancient_browser,$msie;} 在上面的例子中,先不看注释的部分。modern_browser 我们设置了一个...
add_header X-Cache $upstream_cache_status; add_header X-Accel $server_name; } location/image { proxy_pass http://172.30.1.108;proxy_hide_header ETag; proxy_set_header yinzhengjie_nginx_ip_forwarded $proxy_add_x_forwarded_for; }
add_header X-Proxy-Cache $upstream_cache_status; } } } 实际的测试情况,如下所示: [root@VM_16_4_centos conf]# curl -I http://localhost/test.js HTTP/1.1 200 OK Server: nginx/1.14.0 Date: Sun, 21 Jul 2019 12:35:06 GMT Content-Type: text/plain ...
add_header Access-Control-Allow-Headers 'Origin, X-Requested-With, Content-Type, Accept';#服务端可以接收的header add_header Access-Control-Allow-Methods 'GET,POST'; add_header Access-Control-Allow-Credentials, true;#服务端接收认证信息,如cookie ...
add_header X-frame-options SAMEORIGIN; 禁用浏览器的类型猜测 互联网上的资源有各种类型,通常浏览器会根据响应头的Content-Type字段来分辨它们的类型。例如:"text/html"代表html文档,"image/png"是PNG图片,"text/css"是CSS样式文档。然而,有些资源的Content-Type是错的或者未定义。这时,某些浏览器会启用MIME-snif...
# add_header Content-Type text/plain; # Increase buffer size for large headers # This is needed only if you get 'upstream sent too big header while reading response # header from upstream' error when trying to access an application protected by goauthentik ...