of-watchdog
of-watchdog copied to clipboard
HTTP Path is not passed in to handler in http mode
Expected Behaviour
Paths should be forwarded to the upstream function.
Current Behaviour
I tried to run a SimpleHTTPServer in Python and noticed the file-browser wasn't passing through the path.
Possible Solution
Update the proxying code to pass the requestURI
Steps to Reproduce (for bugs)
port=8081 mode=http fprocess="python -m SimpleHTTPServer" upstream_url="http://127.0.0.1:8000" ./of-watchdog
Browse into a directory and see it doesn't work
Context
Running as a Go binary outside of Docker.
We should be careful to test this change since the templates only bind to a single path anyway of /
https://github.com/openfaas-incubator/node8-express-template/blob/master/template/node8-express/index.js#L83
Patch for the fix: https://gist.github.com/alexellis/ba1c3b0fdde166a937810c262d4378df
I experienced the same issue with querystring variables not being passed to the nodejs handler. Do you plan to merge the patch anytime soon?
I am having the same problem: not being able to access GET parameters of the query. It would be nice if you could merge the patch. Many thanks
I tried with the patch, where should I access the Query ? I tried to print Header & Body of handler.Request instance but I cannot find the Query.
Workaround
I succeded to get path and query of the url by tweaking this file: https://github.com/openfaas-incubator/golang-http-template/blob/master/template/golang-http/main.go#L31,L34
You should do something like this:
req := handler.Request{
Body: input,
Header: r.Header,
QueryString: r.URL.Path + "/?" + r.URL.RawQuery,
}
Do not forget to compile ./watchdog with the patch for this to work.
QueryString is passed, use the latest release of the project:
https://github.com/openfaas-incubator/of-watchdog/blob/master/executor/http_runner.go#L102
This issue is about the URL Path, not the QueryString.
Alex