How To Create A Web Server In Python Using Flask

mainLet’s say you’ve built an interesting Python application that runs locally on your machine. Great! Now how can you make that application usable as a service or an API? A lot of times, people build many services that need to play well together to build a final application. An obvious solution to this is to build a web server like Django that can host your application and handle all the incoming requests. But building a full fledged web server seems like an overkill, especially when you are dealing with lightweight services that only need a couple of functionalities. This is where Flask comes into picture! Flask is a Python microframework that can be used to build web servers and create web applications. How do we do that? How do we build a server that can handle different types of requests?   Continue reading

How To Setup Nginx For Load Balancing?

1 mainLet’s say that you have a nice idea for a website and you want to host it somewhere to make it available to the users. To do this, you put your website on a server somewhere on the cloud. Then, you purchase a domain name and you redirect all the requests to this server. But you soon realize that you are getting too much traffic, and that your server won’t be able to handle all of it by itself. So you go ahead and get three more servers. Now you want make sure all your servers share the load in a nice way. How will you do that? We would like to avoid the situation where one of the servers is getting all the traffic, and the remaining servers are getting a small amount. That wouldn’t serve our purpose here! So how we do we handle this?   Continue reading

Forward Proxy vs Reverse Proxy

1 mainIn the previous two blog posts, we discussed about forward and reverse proxies. In this post, we will look at a real example and see how we differentiate between the two. The word proxy describes someone acting on behalf of anyone else. In the world of computers, we are talking about one machine acting on the behalf of another machine. Students do this in real life because they don’t want to attend all the classes, but they want the attendance. Well, machines don’t want to attend all the classes either! So let’s go ahead and see what those differences are and how we can understand them.   Continue reading

What Is A Reverse Proxy?

mainIn the previous blog post, we discussed about proxy servers. Proxy servers basically act like buffers that monitor everything that comes into the user’s machine. We talked about why we need them and how they are used in real life scenarios. We used the analogy of what a person aims to achieve when he proxies for another person. He basically acts on behalf of that other person. Now how would we extend that analogy to explain reverse proxy? Just like how students proxy for fellow students, reverse proxy can mean professors proxying for each other. Does that sound right? What exactly is a reverse proxy and why do we need it?   Continue reading

What Is A Proxy Server?

1 mainIf you are a techie, regardless of the field you are in, you must have heard the term “proxy server”. If you are a web developer, you would hear that term a lot! Off the top of your head, what do you think a proxy server is? It’s basically very similar to what a person aims to achieve when he proxies for another person. That is, to act on behalf of that other person. Remember the good old college days when this used to happen a lot? It was frowned upon by the professors back then. But now, it makes up for a good analogy to discuss an important concept. Now why would we need a proxy server? Why can’t we just talk directly to the actual server and leave this whole proxy thing aside?   Continue reading