Apache Reverse-Proxy 如何修复跨域

How Apache Reverse-Proxy to fix cross-domain

我试过这个:

A​​pache 配置文件:

<VirtualHost *:80>
    DocumentRoot "/www"
    ServerName 12.34.56.78
    ProxyPreserveHost On
    ProxyPass "/" "http://12.34.56.78:82"
    ProxyPassReverse "/" "http://12.34.56.78:82"
</VirtualHost>
<VirtualHost *:82>
    DocumentRoot "/www"
    ServerName 12.34.56.78:82
</VirtualHost>

我的 Javascript/jQuery 代码是:

$.ajax({
        type:'post',
        url:'http://12.34.56.78:80/',
        data:{},
        async:false,
        success:function(data){
           alert('success')
        },
        error : function() {  
           alert('error');
        }  
    });

跨域问题依然存在

试试这个

<VirtualHost *:80>
    ServerName 12.34.56.78
    ProxyRequests off
    ProxyPass "/" "http://12.34.56.78:82"
    ProxyPassReverse "/" "http://12.34.56.78:82"
</VirtualHost>
<VirtualHost *:82>
    DocumentRoot "/www"
    ServerName 12.34.56.78:82
</VirtualHost>

您是否将 apache 配置为侦听端口 82? 例如

Listen 82