douaonong7807 2015-06-15 07:26
浏览 81

如何使用本地运行的AngularJS应用程序中的apache2代理设置访问localhost upload.php

I am running an AngularJS application in my local host port number 9090 which is trying to save an image. I found a quick w3 schools PHP5 Upload link to upload an image. So, Using this method I can quickly verify whether my upload image concept is working or not. When I access this without proxy, this link works fine.

When, I tried to access this link using proxy pass reverse from my AngularJS application, I am not able to access it.

I don't know anything on PHP and I just want to verify the image upload works fine or not.

My Apache2 configuration is here and it is listening on port 80

ProxyPass /upload-test http://127.0.0.1/upload-test/
ProxyPassReverse /upload-test http://127.0.0.1/upload-test/

This is my upload method from angularjs

var fd = new FormData();
//Take the first selected file
fd.append($file, $files[0]);
console.log(fd);
$http.post('/upload-test',fd, {
    headers: {'Content-Type': undefined},
    transformRequest: angular.identity
}).success(function(data,response){
    console.log("Inside Success Function ", response, data);
}).error(function(data,response){
    console.log("Inside Failure Function ", response, data);
});

Really appreciate your help

  • 写回答

1条回答 默认 最新

  • dongqishou7471 2015-06-15 07:43
    关注

    I think thats the right location. As far as I remember all site-enabled are symbolic links to site-available.

    I think your config should look like this:

    ProxyPass /upload-test http://127.0.0.1:9090/upload-test/
    ProxyPassReverse /upload-test http://127.0.0.1:9090/upload-test/
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大