ngx-admin-bundle-support icon indicating copy to clipboard operation
ngx-admin-bundle-support copied to clipboard

CORS - SSL Issues and Implementation

Open enixlabs opened this issue 4 years ago • 4 comments

Good evening.

We are currently trying to setup everything so that the backend and frontend are not on the same network and so processes the request over HTTPS, however we are having issues trying to implement SSL on the backend.

site: https://enixlabs.uk api: https://enua.me <---- Https isn't working

We've tried various options.

const https = require('https') <-- Added code for https
const fs = require('fs') <-- Added certs

polyfills-es2015.8df41bc2e30885896a47.js:1 Mixed Content: The page at 'https://enixlabs.uk/auth/login' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://enua.me:3001/api/auth/login'. This request has been blocked; the content must be served over HTTPS.

polyfills-es2015.8df41bc2e30885896a47.js:1 POST https://[PUBLICIP]:3001/api/auth/login net::ERR_SSL_PROTOCOL_ERROR polyfills-es2015.8df41bc2e30885896a47.js:1 POST https://enua.me:3001/api/auth/login net::ERR_SSL_PROTOCOL_ERROR

Are we missing something when it comes to adding SSL, as nothing seems to work.

We also had to update the app.js for CORS

app.all('/', (req, res, next) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'X-Requested-With');
  next();
});

As it wasn't passing the CORS request for authentication, fixed that problem with the above...

enixlabs avatar Aug 18 '20 19:08 enixlabs

image

This was the issue with CORS before adding in the ACA

enixlabs avatar Aug 18 '20 19:08 enixlabs

I've noticed by taking out the port, the CORS issue presents itself again.

enixlabs avatar Aug 18 '20 23:08 enixlabs

Good evening.

We are currently trying to setup everything so that the backend and frontend are not on the same network and so processes the request over HTTPS, however we are having issues trying to implement SSL on the backend.

site: https://enixlabs.uk api: https://enua.me <---- Https isn't working

We've tried various options.

const https = require('https') <-- Added code for https
const fs = require('fs') <-- Added certs

polyfills-es2015.8df41bc2e30885896a47.js:1 Mixed Content: The page at 'https://enixlabs.uk/auth/login' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://enua.me:3001/api/auth/login'. This request has been blocked; the content must be served over HTTPS.

polyfills-es2015.8df41bc2e30885896a47.js:1 POST https://[PUBLICIP]:3001/api/auth/login net::ERR_SSL_PROTOCOL_ERROR polyfills-es2015.8df41bc2e30885896a47.js:1 POST https://enua.me:3001/api/auth/login net::ERR_SSL_PROTOCOL_ERROR

Are we missing something when it comes to adding SSL, as nothing seems to work.

We also had to update the app.js for CORS

app.all('/', (req, res, next) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'X-Requested-With');
  next();
});

As it wasn't passing the CORS request for authentication, fixed that problem with the above...

Did you solve the issue? how?

Thanks

tmnunes avatar Jan 06 '21 11:01 tmnunes

Good evening. We are currently trying to setup everything so that the backend and frontend are not on the same network and so processes the request over HTTPS, however we are having issues trying to implement SSL on the backend. site: https://enixlabs.uk api: https://enua.me <---- Https isn't working We've tried various options.

const https = require('https') <-- Added code for https
const fs = require('fs') <-- Added certs

polyfills-es2015.8df41bc2e30885896a47.js:1 Mixed Content: The page at 'https://enixlabs.uk/auth/login' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://enua.me:3001/api/auth/login'. This request has been blocked; the content must be served over HTTPS. polyfills-es2015.8df41bc2e30885896a47.js:1 POST https://[PUBLICIP]:3001/api/auth/login net::ERR_SSL_PROTOCOL_ERROR polyfills-es2015.8df41bc2e30885896a47.js:1 POST https://enua.me:3001/api/auth/login net::ERR_SSL_PROTOCOL_ERROR Are we missing something when it comes to adding SSL, as nothing seems to work. We also had to update the app.js for CORS

app.all('/', (req, res, next) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'X-Requested-With');
  next();
});

As it wasn't passing the CORS request for authentication, fixed that problem with the above...

Did you solve the issue? how?

Thanks

Yes in a fashion, we implemented docker into the system and used Nginx to proxy the connection, which gave us full SSL between the two.

enixlabs avatar Jan 06 '21 13:01 enixlabs