I am trying to deploy my application using below tech stack:
Angular - Frontend
Django - Backend
When I am trying to access over https my app the backend is giving following error
Not Found: /
[05/Jul/2021 00:57:08] "GET / HTTP/1.1" 404 2356
[05/Jul/2021 02:42:50] code 400, message Bad request version ('À\x14À')
[05/Jul/2021 02:42:50] You're accessing the development server over HTTPS, but it only supports HTTP.
You're using the development server to host the application, this is not suggested and does not work with https only http.
Use a production grade server like:
Apache
Nginx
Others
For more information visit the django-depolyment docs
You will also need to generate and sign a https certificate, for that I would suggest using Lets Encrpty
Related
After open server, web only run without "http" url
like this127.0.0.1:8000/blog/
and add http with 404 ERROR,where I did wrong?
For now you are developing the Django not deploying it on the server. The http or https will be set with the server configuration file. It don't work now. Simply develop your site and figure this out when you are deploying the app
I'am getting an error message from Angular whenever I try to make an AJAX call to an endpoint of my backend (on a separate domain, running Django 1.7):
Cross origin requests are only supported for protocol schemes: http,
data, chrome-extension, https, chrome-extension-resource
I do have django-corsheaders installed, CORS_ORIGIN_ALLOW_ALL = True and the middleware set up properly. So what's wrong?
I am not sure if this information is relevant, but I am still testing everything on a single host, meaning there is one XAMPP server running for the Angular frontend at localhost and one Gunicorn instance running at localhost:5000 for the backend.
I am able to setup django-allauth with social login using this tutorial.
However I need running all my website in https.
Can django-allauth be successfully and reliably used with django-sslify?
The web server you're hosting Django in handles SSL. If you put Nginx or Apache in front, for example, they will do all the SSL work. Django won't have any concept of being HTTP vs HTTPS.
The django-sslify module doesn't make a site run in SSL, it just redirects any detected non-SSL request to the equivalent SSL URL.
For django-allauth to work with SSL, all you need to do is ensure the configuration of redirect URLs is set to https://... etc.
I am testing a Rest server using Django Rest Framework. By following the tut from Django Rest website I successfully generated a proper API. But when I try to test with backbone.js to talk locally with that server, it seems fail to communicate together.
The server places at address: http://localhost:8080/users/
The client: http://localhost/client
This is the collection and the view in client
var Users = Backbone.Collection.extend({
url: 'http://localhost:8080/apis/',
});
The network after parsing shows status: canceled and type: pending
I suspect the port different caused the error. Could any point me out the correct way ? Thanks
The browser does not allow you to make POST/PUT ajax requests from localhost(:80) to localhost:8080, because of the Same Origin Policy requirement. In order for the browser to consider two addressed as having same origin, they must have the same protocol (http/https), domain name (localhost) and port number.
You can configure the web server at localhost:80 to proxy requests to localhost:8080. Most web servers support this functionality with a simple configuration change. If you are for instance using apache, see documentation.
Sample Apache proxy config:
ProxyPass /api http://localhost:8080/
ProxyPassReverse /api http://localhost:8080/
After this, you can access an address at localhost:8080/users with localhost/api/users:
var Users = Backbone.Collection.extend({
url: '/api/users',
});
I have followed this tutorial: http://www.stephendiehl.com/?p=309 describing how to run a gevent pywsgi server serving Django with socketio behind a nginx front-end.
As this tutorial says, Nginx doesn't support websocket unless using a tcp proxy module. This proxy module doesn't support the use of the same port for socketio and classic serving, from what I understood the configuration look like that:
nginx listen on port 80
nginx tcp proxy listen on port 7000
Everything is forwarded to port 8000
Problem: the resulting socketio request doesn't include the django cookie containing the session id so I have no information on the requesting user in my django view.
I guess it's caused by the fact that the request is made to another port (7000) causing the browser to identify the request as cross-domain ?
What would be the cleanest way to include the django cookie into the request ?
Most answers in this question seem to indicate that port doesn't matter.
Also checked and supposedly WebSockets is regarded as HTTP, so HTTPOnly cookies should still be sent.
SocketIO seems to be using a custom Session manager to track users. Maybe try and link that up?