Welcome! Log In Create A New Profile

Advanced

Re: nginx_cross_origin_module on nginx-1.2.1

姚伟斌
September 11, 2012 02:36AM
HI,

Your request should contain an "Origin: xxx.com" head. If there is no
such header, It's not a valid cors request.

2012/9/11 n1xman <nginx-forum@nginx.us>:
> Hi,
>
> We are trying to implement cross origin resource sharing protocol on our
> system. I just want to try nginx_cross_origin_module and see how it work
> instead of add_header approach.
>
> The issue is I can't see the CORS headers on the response headers. Here is
> my config.
>
> user nginx;
> worker_processes 1;
>
> error_log /usr/local/nginx/logs/error.log info;
> pid /var/run/nginx.pid;
>
>
> events {
> worker_connections 1024;
> }
>
>
> http {
> include /etc/nginx/mime.types;
> default_type application/octet-stream;
>
> log_format main '$remote_addr - $remote_user [$time_local] "$request"
> '
> '$status $body_bytes_sent "$http_referer" '
> '"$http_user_agent" "$http_x_forwarded_for"';
>
> access_log /var/log/nginx/access.log main;
>
> sendfile on;
>
> cors on;
> cors_max_age 3600;
> cors_origin_list unbounded;
> cors_method_list GET HEAD PUT POST OPTIONS;
> cors_header_list unbounded;
>
> server {
> listen 80;
> server_name localhost;
>
> location / {
> root /usr/share/nginx/html;
> index index.html index.htm;
> }
> }
>
>
> Response Headers
> Accept-Ranges bytes
> Content-Length 162
> Content-Type text/html
> Date Tue, 11 Sep 2012 05:04:44 GMT
> Last-Modified Tue, 11 Sep 2012 04:08:30 GMT
> Server nginx/1.2.1-5
>
> Request Headers
> Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Encoding gzip, deflate
> Accept-Language en-us,en;q=0.5
> Connection keep-alive
> Host x.x.x.x
> User-Agent Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20100101
> Firefox/15.0
>
> [root@abmx-test nginx]# nginx -V
> nginx version: nginx/1.2.1-5
> built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
> TLS SNI support disabled
> configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx
> --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
> --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
> --lock-path=/var/run/nginx.lock
> --http-client-body-temp-path=/var/cache/nginx/client_temp
> --http-proxy-temp-path=/var/cache/nginx/proxy_temp
> --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
> --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
> --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx
> --with-http_ssl_module --with-http_realip_module --with-http_addition_module
> --with-http_sub_module --with-http_dav_module --with-http_flv_module
> --with-http_mp4_module --with-http_gzip_static_module
> --with-http_random_index_module --with-http_secure_link_module
> --with-http_stub_status_module --with-mail_ssl_module --with-file-aio
> --with-debug --with-cc-opt='-O2 -g -m32 -march=i386 -mtune=generic
> -fasynchronous-unwind-tables' --without-http_uwsgi_module
> --without-http_scgi_module --without-mail_pop3_module
> --without-mail_imap_module --without-mail_smtp_module
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/yaoweibin-nginx_upstream_check_module-2c5a2c8
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/yaoweibin-nginx_tcp_proxy_module-a40c99a
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/simpl-ngx_devel_kit-24202b4
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/agentzh-echo-nginx-module-080c0a1
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/agentzh-set-misc-nginx-module-87d0ab2
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/mikewest-nginx-static-etags-25bfaf9
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/nginx-sticky-module-1.0
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/agentzh-memc-nginx-module-8befc56
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/agentzh-srcache-nginx-module-8df221e
> --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/yaoweibin-nginx_cross_origin_module-7319ab1
>
> Do you need to build the module for the nginx-1.2.1 version or I'm missing
> something here...?
>
> Thanks in advance
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,230641,230641#msg-230641
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx_cross_origin_module on nginx-1.2.1

n1xman September 11, 2012 01:16AM

Re: nginx_cross_origin_module on nginx-1.2.1

姚伟斌 September 11, 2012 02:36AM

Re: nginx_cross_origin_module on nginx-1.2.1 - solved

n1xman September 17, 2012 11:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 93
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready