Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Path is not passed in to handler in http mode #16

Open
alexellis opened this issue Apr 24, 2018 · 5 comments
Open

HTTP Path is not passed in to handler in http mode #16

alexellis opened this issue Apr 24, 2018 · 5 comments

Comments

@alexellis
Copy link
Member

alexellis commented Apr 24, 2018

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)

  1. 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

@alexellis
Copy link
Member Author

@satie
Copy link

satie commented May 4, 2018

I experienced the same issue with querystring variables not being passed to the nodejs handler. Do you plan to merge the patch anytime soon?

@lapwat
Copy link

lapwat commented May 11, 2018

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

@lapwat
Copy link

lapwat commented May 14, 2018

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.

@alexellis
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants