I want one page on the site to generate koa.js for nodejs , and others django for python . For example,
The GET /nodejs must be answered by nodejs, and GET /python must be answered by python.
Can this be done and how?
I want one page on the site to generate koa.js for nodejs , and others django for python . For example,
The GET /nodejs must be answered by nodejs, and GET /python must be answered by python.
Can this be done and how?
It is impossible to hang on one port, you can make a reverse proxy that will redirect requests to NodeJS and Python, but then NodeJS and Python should hang on their ports to which the redirection will go, I would make the main server on NodeJS which would redirect to Python If the system is nix, you can even do it on Unix sockets, it will be faster and less to load the processor.
In production, "application servers" (that which directly hosts the application with the interpreter) usually do not stick out. Usually they are covered with "reverse proxy" .
Then, in a good way, a considerable part of requests to applications simply requests files, without additional logic and checks . It is good if the application server, say, is written to a large extent on some C, and can deal with such requests without even asking the interpreter. But usually, to provide a good, customizable interface, the server stitches tightly with the interpreter and runs much slower than something that is written on its own in C or something comparable. But it already depends on the implementation of specific servers.
Some application servers are not initially designed to stick out without protection. Not because they are easy to hack, but because a malicious client can drop them . Scripts described in one of his answers earlier.
More so that it was possible to lift several processes of one application and scatter requests between them . This is called a load balancer. When the load becomes large, these processes can even be spread by different machines.
Still for the sake of caching frequent requests with the same answers. Although setting it up rarely goes without incident.
More for the sake of protection . Web servers, typically working in the role of balancers, are usually extremely resistant to the loads themselves, and can be developed in this direction by additional efforts by configuring or adding additional modules that check queries and (possibly) ban violators.
I mainly meet in their role:
... and a typical case : when the necessary port (80?) listens to the proxy, and receives requests, respectively, the proxy, and receiving requests, the proxy does one of:
127.0.0.1 (from the connection point of view); this is usually corrected by adding the X-Forwarded-For header to the request sent, where the real client address is written.Source: https://ru.stackoverflow.com/questions/562203/
All Articles