如何配置WAMP Apache服务器允许的Ajax跨域请求? [英] How to config WAMP apache server to allow cross domain requests of ajax?

查看:4045
本文介绍了如何配置WAMP Apache服务器允许的Ajax跨域请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个煎茶触摸-2.1.0-基于application.The应用程序处理一些跨域请求。

I am working on an sencha-touch-2.1.0-based application.The application deals with some cross-domain requests.

我们包裹着的Andr​​oid code。与PhoneGap的js的文件,以使应用程序运行在Android手机。

We wrapped the js files with Android code with PHONEGAP to make the application run in a Android Phone.

和我已经安装了WAMP服务器的Apache的版本是2.4.4。

And i have installed the wamp server whose apache version is 2.4.4.

我要测试的Andr​​oid手机浏览器的应用程序的UI,所以我把的src 在WAMP的Apache服务器的WWW目录中的煎茶触摸应用程序的文件。

I want to test the UI of the app in a Android Phone browser,so i put the src files of the sencha touch application in the www directory of the apache server of the WAMP.

但我已经在Chrome的PC控制台得到了一个请求错误:

But i have got an request error in the console of Chrome in PC:

    Origin http://192.168.1.102 is not allowed by Access-Control-Allow-Origin.//192.168.1.102 is the ip of my WAMP server.

在在谷歌时,我发现像

`<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin: *
</IfModule>`

办法改变Apache服务器的httpd.conf文件,让AJAX跨域请求。
但它没有作用。
那么,如何可以改变Apache服务器的httpd.conf中?

way to alter the httpd.conf of the apache server to allow ajax cross domain requests. But it dose not work. So how can i change the httpd.conf of the apache server ?

推荐答案

您在正确的轨道上。现在所要做的唯一一件事是使头模块。这是可以做到如下:

You were on the right track. The only thing left to do now is to enable the headers module. This can be done as follows:


  • 点击图标瓦帕在系统托盘

  • 去到Apache> Apache模块

  • 选中选项headers_module

执行此操作后,WAMP将重新启动,你把你的帖子的配置将工作

After you do this, wamp will restart and the configuration you put in your post will work

这篇关于如何配置WAMP Apache服务器允许的Ajax跨域请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆