Attaching arbitrary headers to requests
rudiejd opened this issue · comments
hi there, thank you for this plugin! I'd love to use it with my source graph instance, but it is unfortunately hidden behind a reverse proxy. I need to specify a header in every call made to sourcegraph, or provide a cookie that contains this header. What would be the best way of achieving this? I've tried to hack my way through the Lua, specifying this on the RPC call here:
Line 50 in cb5c6e9
So just to be clear, you need to be able to add a special HTTP Header to the requests? I should be able to make that happen if that's what you're saying. I can provide a config point that lets you provide a table with additional headers.
@tjdevries yep, that is exactly what I'm saying! I'm also willing to make a PR to add this in if such a contribution would be welcome
I can push an update -- there's a bit of ceremony involved for getting a new rust version update, so I'll do that.
The headers are the same for every request? So you can set them ~static at runtime (can update, but doesn't need to update for every request?)?
Yep, should be the same for every request in our case.
Does what is in #191 give you what you're looking for? To test locally, you should be able to pull the branch down and then run cargo build --all
in the repo, and it should pick up the local binaries. I have to do a bit more testing on it, but the idea is in the right direction I think
hmmmm, it's still not working for me. SRC_HEADERS
should be JSON with { "{header_name}": "{header value}"}
, correct?
Could definitely just be an issue somewhere on my side though
you would do:
require('sg').setup {
src_headers = {
key = value
}
}
you shouldn't have to do the environment variable (I set that to pass information to subprocesses)
gotcha, thank you!!! It's sending the right headers, so all good on my end! Thank you TJ!
Sorry for the delay, I left sourcegraph but am doing some contracting stuff to support sg.nvim now :) Should be merged and working. Thanks for your patience!