salt icon indicating copy to clipboard operation
salt copied to clipboard

[FEATURE REQUEST] file.managed / cp.cache_file - support for headers for http(s) urls

Open ITJamie opened this issue 4 years ago • 6 comments
trafficstars

Is your feature request related to a problem? Please describe. It would be extremely useful to be able to pass headers / auth information when using file.managed states. Certain file downloads are secured behind rest apis or basic auth.

Describe the solution you'd like Similar to what was proposed here: https://github.com/saltstack/salt/issues/40537#issuecomment-292338562. Having the ability to pass additional args to the http(s) servers when using the source variable. arg options should include the ability to set request type (GET), headers including content types, auth params (user/password)

Describe alternatives you've considered Using cmd.run to do a curl with the required args. Which is not exactly a great use-case and makes it harder to trigger follow on tasks if the file is changed. eg: https://stackoverflow.com/questions/31504258/using-file-managed-for-downloading-a-file-in-salt

Additional context Example uses. downloading private builds from gitlab/github via the api which requires header auth

ITJamie avatar Oct 14 '21 11:10 ITJamie

Seconding this; surprised this isn't implemented already. This is also a necessity for e.g. using token auth to Vault to fetch an internal CA chain (which cannot be done via the quite limited Vault module).

johnnybubonic avatar Jan 27 '22 22:01 johnnybubonic

Same, this would be very useful

goapunk avatar Apr 06 '22 15:04 goapunk

This would be useful for using nexus as well.

rfilgas-apex avatar Oct 17 '22 17:10 rfilgas-apex

+1 I stumbled upon this feature request while researching how to auth to https servers using file.managed.

Gulluth avatar Feb 15 '23 21:02 Gulluth

Would love to use this as well.

If someone hints me a bit in the direction where I can find the important pieces in the code, I'd be pleased to implement it.

dithmer avatar Aug 30 '23 13:08 dithmer

I also want to +1 this. I'm here because I have a server that won't let file.managed download a file unless it provides an Accept header :upside_down_face:

jdelic avatar May 07 '24 14:05 jdelic