2014-01-09 4 views
2
에 작동하지

나는 내 서버에 내 로컬 호스트에서 아약스 게시물을 할 때 크로스 원산지 문제가 계속 :액세스 제어 - 허용 - 원산지 아파치

OPTIONS http://domain:port/fileuploader/fileupload No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. plupload.full.min.js:14 
XMLHttpRequest cannot load http://domain:port/fileuploader/fileupload. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. 

그래서 내가이 모든 것을 할 수 있도록 추가 아파치를 사용하고 있습니다 하지만 여전히 현재 작업 :

Header add Access-Control-Allow-Origin * 
Header add Access-Control-Allow-Headers "SOAPAction, Authorization, username, password, origin, X-Requested-With, Content-Type, XMLHttpRequest" 
Header add Access-Control-Allow-Methods "POST, GET, PUT, DELETE, OPTIONS" 
Header add Access-Control-Allow-Credentials: "true" 

브라우저에서 응답 헤더는 다음과 같습니다

Request URL:http://domain:port/fileuploader/fileupload 
Request Method:OPTIONS 
Status Code:200 OK 
Request Headersview source 
Accept:*/* 
Accept-Encoding:gzip,deflate,sdch 
Accept-Language:en-US,en;q=0.8,ar;q=0.6 
Access-Control-Request-Headers:content-type 
Access-Control-Request-Method:POST 
Cache-Control:no-cache 
Connection:keep-alive 
Host:domain:port 
Origin:http://localhost 
Pragma:no-cache 
Referer:http://localhost/omnixuploader/index.html?dDocName=test8818&dDocTitle=test8818&dDocType=SiebelAttachment&dDocAuthor=SADMIN&lan=ara&files=test|jpg:png:txt|220,wwow|pdf:txt:zip|222&rand=19 
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 
Response Headersview source 
Allow:GET, HEAD, POST, TRACE, OPTIONS 
Content-Length:0 
Date:Thu, 09 Jan 2014 14:39:45 GMT 
X-ORACLE-DMS-ECID:a3121f70a766128a:-422d6665:14370f7c3a3:-8000-000000000000057a 
X-Powered-By:Servlet/2.5 JSP/2.1 

I 왜 작동하지 않는지 이해하지 못합니까? 어떤 힌트?

답변

1

http://localhost을 구성하는 것으로 보아 다른 사이트가 브라우저에 요청하도록 권한을 부여한 것 같습니다.

http://domain:port/에게 알려야합니다.

X-Powered-By:Servlet/2.5 JSP/2.1은 Apache Tomcat을 사용 중임을 나타냅니다. 해당 서버를 구성하는 방법은 in answers to this question입니다.

+0

구성은 위의 도메인 아파치의 httpd.conf에서 수행되도록 내 도메인 로컬 호스트에서 게시물을하려고하고, 도메인이있다 (헤더 추가 Access-Control-Allow-Origin *) –

+0

그러면 예제에서': port'로 대체 한 포트 번호에서 실행되는 서버가 아니라 포트 80에서 실행되는 서버를 구성하는 것처럼 보입니다. – Quentin

+0

게시 할 게시물은 7001입니다. 어떻게해야합니까? –

0

먼저 헤더를 설정하려고하고 다른 사람을 추가

Header set Access-Control-Allow-Origin * 

Header add Access-Control-Allow-Headers "SOAPAction, Authorization, username, password, origin, X-Requested-With, Content-Type, XMLHttpRequest" 

Header add Access-Control-Allow-Methods "POST, GET, PUT, DELETE, OPTIONS" 

Header add Access-Control-Allow-Credentials: "true" 
관련 문제