This site can't provide a secure connection ERR_SLL_PROTOCOL ERROR - django

I have a google appengine project running in localhost. Everything works fine until i go to the 'login' page. When i go there i get the following error:
This site can’t provide a secure connection 127.0.0.1 sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR
the appengine command i use to run the project is dev_appserver.py" --host 127.0.0.1 . This is run pycharm. This only occurs in the 'login' endpoint and no other endpoint.
The console error i get is:
default: "GET /signin HTTP/1.1" 301 -

to connect over HTTPS you need a valid SSL certificate on your server here is you local server as I understand from the message. you can get a certificate for your local server but I don't think it's worth the trouble while working locally. On the other hand when you deploy to Google App Engine, you get SSL certificate automatically and it's managed by Google, that's why your code works without any problem in the deployment.

Related

Error during WebSocket handshake: Unexpected response code: 502 - Django

I am running my server on a ec2 instance with gunicorn and nginx. My site and project works but it gives error connecting with websockets. I am using Websocket in js to connect with Django channels. On my local server everything was working correctly but after deploying my site. Websockets are not working and giving me this error
Error during WebSocket handshake: Unexpected response code: 502.
What I have tried uptil now...
I have installed redis and daphne. Configured daphne setting in nginx configuration.
My Server is running on 80 port and I have set daphne on 8001 port.
When I start daphne service it runs for some time and then disconnect/fail automatically but when it is running my websockets still cant connect.
Any kind of help will be great for me.

The error of Django application crashed ngnix and the server

My Django application run well for a while, then I got 502 Bad Gateway, after a few hours, I am unable to ping the domain and use SSH to connect my server(from Amazon Lightsail). My other application served by ngnix was also not available then. While if I didn't start the Django application, ther application served by ngnix would run steadily. So I guess it is the error of my Django application crashed ngnix and the server.
After rebooting the server for serveral times, the server seems recovered then I can ping the domain and use SSH to connect the server. But after a while, the same problem would occurs again. I wonder how to fix the problem.
Some diagnostic information since the start of the Django application to the end of the Nginx server provided below.
The RAM usage is high during the process.
The uwsgi log. https://bpa.st/FP7Q
The Nginx error log. https://bpa.st/35EQ

Browser error during django + SSL connection with local server

I have a problem during adding facebook login button to my website at localhost.
I've already add mysite.com to hosts file and installed django-extensions, werkzeug, pyOpenSSL. By running command python manage.py runserver_plus --cert-file cert.crt my own-made sertificate was created. I imported this certificate to Trusted Chrome sertificates but safe connection doesn't establish. When i pass https://example.com:8000/account/login/ I hit an error NET::ERR_CERT_COMMON_NAME_INVALID,
Failed to confirm that this is the server example.com. Its safety certificate refers to *. The server may be configured incorrectly or someone is trying to intercept your data.
Please help me to solve this.

Can't connect to Flask-Socketio via wss but works via ws

I have built a Flask-Socketio server application which works as expected when I connect to it using a javascript client via ws, but fails to connect via wss, both on localhost and when running on my Digital Ocean server. With wss, I get this error in the console (client running on Heroku):
index.js:14 WebSocket connection to 'wss://[IP_ADDRESS]/socket.io/?
EIO=3&transport=websocket' failed: Error in connection establishment:
net::ERR_CONNECTION_REFUSED
When the client is running on localhost, it causes this error:
polling-xhr.js:265 GET https://localhost:5000/socket.io/?
EIO=3&transport=polling&t=MW6p0Aj net::ERR_SSL_PROTOCOL_ERROR
The flask server is running with
socketio.run(app, host='0.0.0.0', port=443) # production
or
socketio.run(app, host="localhost", port=5000) # localhost
At first I thought it could have been an issue with the Nginx configuration or server ports not being open, however the same issue occurs with the server running on Localhost, so now I'm suspecting an issue with my Flask-Socketio application
Turns out I didn't have SSL certificates configured. I followed the instructions in this guide to create a self-signed SSL certificate and configure Nginx to use it. Now works as expected.
There are lot of issues with Flask-Socketio. With Apache server it almost doesn't works.But you are using Nginx. Refer following link on github.
https://github.com/miguelgrinberg/Flask-SocketIO/issues/298#issuecomment-408682588

404 Error - AWS EC2

When I try to open my instance via the Public DNS, I get a 404 error.
However, in my security group, I have HTTP/HTTPS/SSH configured to allow all incoming requests. When I connect to the instance via SSH, I can see all of my files there from my repo.
I am running on an Ubuntu 64-bit server with Nginx and Gunicorn.
Any help would be appreciated.
Thank you in advance!
Two possibilities for getting 404 file not found error
Make sure /usr/share/nginx/html/index.html is found or not.
check with nginx.conf file, if it is directing to index.html or not.