单独打开某个网站的配置文件,在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-...
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请求转发 ...
用于http,server,location模块 30.large_client_header_buffers 语法:large_client_header_buffers number size 默认值:large_client_header_buffers 4 4k/8k 功能:指定客户点一些比较大的请求头使用的缓冲区数量和大小。请求头行不能够大于一个缓存的大小。如果客户端发送了一个较大的头,Nginx将会返回“Request URI ...
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; }
位置: HTTP Response Header 说明: 缓存策略定义 max-age: 标识资源能够被缓存的最大时间 public: 表示该响应任何中间人,包括客户端和代理服务器都可以缓存 private: 表示该响应只能用于浏览器私有缓存中,中间人(代理服务器)不能缓存此响应 no-cache: 需要使用对比缓存(Last-Modified/If-Modified-Since/Etag/If-No...
proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE_HOST $server_name; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://www.hxwise.com:27180; #在/etc/hosts已配置: 36.110.13.137 www.hxwise.com ...
add_header X-frame-options SAMEORIGIN; 禁用浏览器的类型猜测 互联网上的资源有各种类型,通常浏览器会根据响应头的Content-Type字段来分辨它们的类型。例如:"text/html"代表html文档,"image/png"是PNG图片,"text/css"是CSS样式文档。然而,有些资源的Content-Type是错的或者未定义。这时,某些浏览器会启用MIME-snif...
proxy_pass_header Server; //Server name and version will be hidden Final nginx.conf file looks like : server { listen 9090; server_tokens off; location / { access_log off; add_header Content-Type text/plain; return 200; } location /test { rewrite /test/(.*) /$1 break; proxy_pass...