<servlet><servlet-name>root</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext-web.xml</param-value></init-param><init-param><param-name>dispatchOptionsRequest</param-name><param-value>true</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>root</servlet-name><url-pattern>/</url-pattern></servlet-mapping>
location ~/api/* { dav_methods PUT DELETE; if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '$http_origin'; add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-CustomHeader,Keep-Alive, User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; add_header 'Access-Control-Max-Age' 3600; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; } if ($request_method = 'POST') { add_header 'Access-Control-Allow-Origin' '$http_origin'; add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-CustomHeader,Keep-Alive, User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; } if ($request_method = 'GET') { add_header 'Access-Control-Allow-Origin' '$http_origin'; add_header 'Access-Control-Allow-Methods' 'GET, POST,DELETE,PUT, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-CustomHeader,Keep-Alive, User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; } if ($request_method = 'PUT') { add_header 'Access-Control-Allow-Origin' '$http_origin'; add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-CustomHeader,Keep-Alive, User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; } if ($request_method = 'DELETE') { add_header 'Access-Control-Allow-Origin' '$http_origin'; add_header 'Access-Control-Allow-Methods' 'GET, POST,DELETE,PUT, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-CustomHeader,Keep-Alive, User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; } root /opt/www/web/; index index.jsp; proxy_pass <a rel="nofollow" href="http://localhost.html" target="_blank"> <a rel="nofollow" href="http://localhost" target="_blank">http://localhost</a></a>:8089; include /opt/conf/nginx/proxy.conf; }
以上就是nginx跨網域設定 nginx apache nginx php nginx rewrite的內容,更多相關內容請關注topic.alibabacloud.com(www.php.cn)!