Is bloom adding an extra / in the pathname on purpose?
andersonsantos opened this issue · comments
Hi there @valeriansaliou - first I would like to thank you for adding support for forced locale at sonic. I just found out about bloom and spend some time testing it today...
When I use Bloom to proxy to a demo express js api, it is adding an extra / in the pathname.
Exemple:
curl --header "Bloom-Request-Shard: 0" http://127.0.0.1:5555/testing-path
The req object in the express js get this values:
Url {
protocol: null,
slashes: null,
auth: null,
host: null,
port: null,
hostname: null,
hash: null,
search: null,
query: null,
pathname: '//testing-path',
path: '//testing-path',
href: '//testing-path',
_raw: '//testing-path' },
params: { '0': '//testing-path' }
I can bypass this by just adding an extra / before each of my routes, but is this the expected behavor for Bloom's proxying process?
Thanks!
P.s.: I'm loving your work!
Hello!
I've just tested, and you're right, Bloom is prepending a "/" in the request URL, and that's definitely not intended:
⋊> ~ nc 127.0.0.1 -l 3000 18:36:05
GET //testing-path HTTP/1.1
Host: [::1]:8080
User-Agent: curl/7.54.0
Accept: */*
Bloom-Request-Shard: 0
My Bloom development environment hits against a Restify-based API, which has never shown that. I think it sanitized URLs and cleaned them up before printing them to logs, which may explains why I've never noticed that.
Fixing that now!
Fixed in 91c566e
Thanks 👍