I want to build a golang service which will listen for GET request, do some URL manipulation and then proxy a new request (to the manipulated URL) back to the browser:
(from browser -> server) GET http://www.example.com/7fbsjfhfh93hdkwhfbf398fhkef93..
(server manipulates URL - decrypts "7fbsjfhfh93hdkwhfbf398fhkef93.." -> "my-super-resource")
(server -> URL resource) GET http://www.somewhereelse.com/my-super-resource
(server -> browser) Response from http://www.somewhereelse.com/my-super-resource passed on to browser (using cors)
The whole chain will need to be synchronous which is ok. Is there a decent proxy library which allows for this sort of thing?
ReverseProxy?http.HandlerFunc, receive a request, do something to the request, then make another request with a package like Sling, wait for the response, and use that response to send the response back to the original request. That gives you the proxy behavior as well and doesn't depend too much on any sort of a "framework" approach. Plus, I highly doubt you'll find anything that will allow you to do exactly what you detailed with precision. That is very specific...you will likely need to write some custom code as explained above.