Skip to main content

Posts

Featured

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 sitewith different ports and then use the reverse proxy to map to map the domain name to the port




ExplanationScenario 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 12 13 14 15 16 17func main() { // New functionality written in Go http.HandleFunc(&…

Latest posts

Hyperldeger Fabric Composer : Essential ACLs

use elasticmail api with golang example

Setup development environment for Hyperledger composer on windows

setup scheduled export on google appe