Apache前端can';t请求表示后端

Apache前端can';t请求表示后端,apache,express,vue.js,Apache,Express,Vue.js,我正在apache服务器上托管vueJS前端。只要调用“npm run service”并通过http访问我的页面(在express后端启用https),我就可以成功地向后端请求,而无需运行apache 启动apache并通过https(自签名SSL证书)访问页面时,我无法发送请求 Firefox错误: Cross-source (cross-origin) request blocked: The same source rule prohibits reading the external

我正在apache服务器上托管vueJS前端。只要调用“npm run service”并通过http访问我的页面(在express后端启用https),我就可以成功地向后端请求,而无需运行apache

启动apache并通过https(自签名SSL证书)访问页面时,我无法发送请求

Firefox错误:

Cross-source (cross-origin) request blocked: The same source rule prohibits reading the external resource on https://143.93.46.35:60702/user/login. (Reason: CORS request failed).
和铬:

xhr.js:160 POST https://143.93.46.35:60702/user/login net::ERR_SSL_PROTOCOL_ERROR
我在express后端上启用了https,如:

https.createServer({
    key: fs.readFileSync('certs/apache-selfsigned.key'),
    cert: fs.readFileSync('certs/apache-selfsigned.crt')
  }, app)
  .listen(nconf.get('port'), function() {
    console.log(`App listening on port lalala! Go to https://localhost:3000/`)
  });
在app.js中启用cors,如:

const cors = require('cors');
...
// Enable CORS (cross origin resource sharing)
app.use(cors({
  credentials: true,
  origin: true
}));

app.options('*', cors());
处理axios调用的vue服务是:

const apiClient = axios.create({
  baseURL: `https://inf-education-47.umwelt-campus.de:60702`,
  withCredentials: false, // This is the default
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json'
  }
})

export default {
  // user Endpoints
  getUser (email) {
    return apiClient.get(`/user/${email}`)
  },
  registerUser (user) {
    return apiClient.post(`/user/register`, user)
  },
  loginUser (user) {
    return apiClient.post(`/user/login`, user)
  },
  ...
在apache中,我编辑了vhost conf以启用COR,如:

<VirtualHost *:80>
    ServerAdmin webmaster@test.de
    DocumentRoot /var/www/client/pvapp-client/dist
    Header set Access-Control-Allow-Origin "*"
    ....

服务器管理员webmaster@test.de
DocumentRoot/var/www/client/pvapp client/dist
标题集访问控制允许原点“*”
....

使用apache通过https托管vue时出现错误的原因是什么?

您的CORS设置在哪里?这可能是一个CORS问题,而不是HTTPS问题。我已经在express中启用了CORS。同样在apache vhost设置中@这是CORS的错误。您应该在允许的位置显示express cors配置origin@Dan我编辑了这个问题。只是为了好玩,如果将cors配置替换为
app.use(cors())
,会发生什么?