Skip to main content

Posts

Showing posts with the label Networking

Host Multiple Web Sites of Go Using Reverse Proxy Example

Go supports built-in server. But there is a limitation that you can host only one site at once with one port. Though you can host multiple sites with the domain name using gorilla mux then all site will come with one app that will be very hard to maintain and update.  Another option is you can host your site with different ports and then use the reverse proxy to map to map the domain name to the port Explanation Scenario  I have two sites running on my vultr vps . All of them are website that means request will be come in with  domain name and going to be arrived on the port 80 . If  I assing one program [ site ] to listen to the port 80 others will not be able to listen on port 80.  Condition Requirement is that requests should be listend on port 80 and handled by the app to which it relates. After struggling for 3 days i got this 😂 silly solution. Source Code ( solution I got ) 1 2 3 4 5 6 7 8 9 10 11 1...

Forward Proxy Using Apache

There are many scenarios where we need some kind of proxy. We will consider one scenario from all where we need to use the forward proxy. Case : Suppose there is a service which is available for certain IP/ IPs only (These are mostly secured services). In this case, you have to forward the service requests through that specific.  Take an example : Entities playing role, Hosting App On Google App Engine ( Dynamic IP) White Listed Server ( X.X.X.X ) Resource Server ( Y.Y.Y.Y ) Here  Resource    Server ( Y.Y.Y.Y ) will just respond to the request come from the White Listed IP  Server   ( X.X.X.X ). So if we want to request   Resource   Server (Y.Y.Y.Y) we have to send it to the way Server feel like they have come from White Listed Server IP (X.X.X.X). Here Proxy server comes in the play. Proxy server takes the request and forwards it as they are initiated by itself. So what we have to do is we have to put a proxy ser...