Nginx Deal with OPTIONS in HTTP Protocol
The idea is to add the OPTIONS in nginx configuration to deal with that.
location / {
if ($request_method = OPTIONS ) {
add_header Content-Length 0;
add_header Content-Type text/plain;
add_header OPTIONS, GET, HEAD, POST, PUT, DELETE;
return 200;
}
try_files $uri @python_webapp;
}
if ($request_method = OPTIONS ) {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin,X-Requested-With,Content-Type,Accept,Authorization';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 200;
}
Django 1.4 Deal with that
https://django.readthedocs.io/en/1.4.X/ref/contrib/csrf.html
https://github.com/adamchainz/django-cors-headers/tree/3b58d638ef08a644dc8ebfc68a7ffdf09835b839/#configuration
References:
https://stackoverflow.com/questions/33548537/error-when-adding-add-header-to-nginx
https://stackoverflow.com/questions/227939/handling-options-request-in-nginx
https://stackoverflow.com/questions/11926908/how-to-respond-to-an-http-options-request
分享到:
相关推荐
windows下编译的nginx,添加了nginx-http-flv-module,可用作实时流媒体服务器使用,具体是使用和配置方面可参照https://github.com/winshining/nginx-http-flv-module进行使用和配置。
nginx with rtmp module rpm 安装包,免依赖,一键安装, 支持centos7.x。
随着flash的禁用,rtmp已经不适合用浏览器播放了,nginx-http-flv-modle很好的帮我们解决了这个问题,资源已经编译好了,解压即用,少去了找编译工具的烦恼 。
1. 采用nginx最新版编译,包含最新的nginx-http-flv-module,以及基础模块openssl、prce、zlib 2. 整体打包,已配置好nginx.conf的http-flv直播流,以及http web环境。无需任何配置即可使用 3. 自带windows的服务...
nginx带nginx-http-flv模块,包含所有rtmp功能,我自己在windows下编译的,直接可用,用的是最新版的1.19.4版本
nginx配置中找到对http method的所有制约
windows平台nginx编译nginx-http-flv-module,可直接运行,基于nginx-1.17.10编译
nginx 1.10.2 with stream module for ar71xx/ar91xx on openwrt 17.01
在windows 7 64位 环境下使用nginx的nginx-http-flv-module搭建flv视频流播放所有的安装包,参考:https://blog.csdn.net/qq_33071429/article/details/102628008
1、nginx-http-flv-module(windows可执行程序,含http-flv-module:1.2.7,nginx 1.19.3) 2、不要放置于中文路径下,否则无法启动 3、说明文档,请下载查看。
这时Nginx后台需要自动将Http请求转成Https的方式,这样就又能支持Http,又能保证通信安全了。 废话不多说,下面直接贴一个Nginx支持Http和Https的配置,是我的wordpres网站支持Https的配置,大家何以参考。 server...
This book is a detailed guide to setting up Nginx in different ways that correspond to actual production situations: as a standalone server, as a reverse proxy, interacting with applications via ...
Get the newest techniques available, designed with the latest version in mind Who This Book Is For By covering both the early setup stages and advanced topics, this book suits web administrators who ...
Nginx中http请求处理过程 有不少地方不是很明白 ,还望大家共同交流
已编译好的nginx-http-flv-molule(windows版) 基于: --> openssl-1.1.1g --> pcre-8.44 --> zlib-1.2.11 --> nginx-http-module-v1.2.10 --> nginx-1.21.6 ======================== 在网上查找半天都只有教程,...
添加nginx-http-flv-module模块并重新编译后的nginx(windows版)
基于nginx1.19.3版本,已编译好nginx-http-flv-module,开箱即用。鄙视那些收C币的。
采用官网下载的nginx 1.17.7、nginx-http-flv-module 1.2.7编译而成的64位nginx程序。
Nginx配置http转https以及https访问http静态资源.docx