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

trunk proxy does not work #95

Closed
ranile opened this issue Nov 29, 2020 · 3 comments
Closed

trunk proxy does not work #95

ranile opened this issue Nov 29, 2020 · 3 comments
Labels
bug Something isn't working cli Trunk CLI application good first issue Good for newcomers

Comments

@ranile
Copy link
Contributor

ranile commented Nov 29, 2020

I have an API running at localhost:9090/api/ with endpoint /hello/... and a proxy configured as

[[proxy]]
backend = "http://localhost:9090/api/"

with trunk running at localhost:8080

Actual results

Requests at localhost:8080/ and localhost:8080/api/hello/test return index.html

img1

Expected results

Requests at localhost:8080/ to return index.html but requests at localhost:8080/api/hello/test to return the response provided by the server.
image

Additional context

Discord discussion

@thedodd
Copy link
Member

thedodd commented Dec 2, 2020

Thanks for submitting this issue @hamza1311! I'm hoping to have some time to look into this soon. I've been using a very similar setup quite successfully for a while now, so this might be a subtle bug of some sort.

All in all, the code for the server & proxy is dead simple. If you would like to take a look at the code as well, please feel free :)

@thedodd thedodd added bug Something isn't working cli Trunk CLI application good first issue Good for newcomers labels Dec 2, 2020
@jakule
Copy link

jakule commented Jan 2, 2021

I had the same problem. Looks like after you register file handler with server_dir() tide ignores routes registered with all() -
This https://github.com/http-rs/tide/blob/main/src/route.rs#L139 takes precedence over all() https://github.com/http-rs/tide/blob/main/src/route.rs#L178-L180

I fix the problem in my fork jakule@dc6fb69. @thedodd If you are interested in merging it I can create a PR.

thedodd added a commit that referenced this issue Mar 4, 2021
The issue described in #95 has been thoroughly tested & is now fixed.
Shoutout to @jakule for their work on implementing a solid fix for this.

closes #95
thedodd added a commit that referenced this issue Mar 4, 2021
The issue described in #95 has been thoroughly tested & is now fixed.
Shoutout to @jakule for their work on implementing a solid fix for this.

closes #95

Co-authored-by: Hamza <muhammadhamza1311@gmail.com>
thedodd added a commit that referenced this issue Mar 4, 2021
The issue described in #95 has been thoroughly tested & is now fixed.
Shoutout to @jakule for their work on implementing a solid fix for this.

closes #95

Co-authored-by: Hamza <muhammadhamza1311@gmail.com>
thedodd added a commit that referenced this issue Mar 4, 2021
The issue described in #95 has been thoroughly tested & is now fixed.
Shoutout to @jakule for their work on implementing a solid fix for this.

closes #95

Co-authored-by: Hamza <muhammadhamza1311@gmail.com>
thedodd added a commit that referenced this issue Mar 4, 2021
The issue described in #95 has been thoroughly tested & is now fixed.
Shoutout to @jakule for their work on implementing a solid fix for this.

closes #95

Co-authored-by: Hamza <muhammadhamza1311@gmail.com>
thedodd added a commit that referenced this issue Mar 4, 2021
The issue described in #95 has been thoroughly tested & is now fixed.
Shoutout to @jakule for their work on implementing a solid fix for this.

closes #95

Co-authored-by: Hamza <muhammadhamza1311@gmail.com>
@thedodd
Copy link
Member

thedodd commented Mar 4, 2021

@jakule I've used your suggested changes over in #137 and they do indeed resolve the issue (I've tested it extensively). I've given you attribution in the commit log :)

@thedodd thedodd closed this as completed in eb4d33c Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Trunk CLI application good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants