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

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

Open
ITJamie opened this issue Oct 14, 2021 · 6 comments · May be fixed by #67153
Open

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

ITJamie opened this issue Oct 14, 2021 · 6 comments · May be fixed by #67153
Labels
Feature new functionality including changes to functionality and code refactors, etc.
Milestone

Comments

@ITJamie
Copy link
Contributor

ITJamie commented Oct 14, 2021

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: #40537 (comment). 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 ITJamie added Feature new functionality including changes to functionality and code refactors, etc. needs-triage labels Oct 14, 2021
@frogunder frogunder added this to the Approved milestone Oct 18, 2021
@frogunder frogunder removed their assignment Oct 18, 2021
@johnnybubonic
Copy link

johnnybubonic commented Jan 27, 2022

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

@goapunk
Copy link
Contributor

goapunk commented Apr 6, 2022

Same, this would be very useful

@rfilgas-apex
Copy link

This would be useful for using nexus as well.

@Gulluth
Copy link
Contributor

Gulluth commented Feb 15, 2023

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

@dithmer
Copy link

dithmer commented Aug 30, 2023

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.

@jdelic
Copy link
Contributor

jdelic commented May 7, 2024

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 🙃

jdelic added a commit to jdelic/saltshaker-laptop that referenced this issue May 7, 2024
… will not return data when there is no Accept header. And unfortunately salt.utils.http.query does not set an Accept header. So file.managed can't download the albert key file.
@SndR85 SndR85 linked a pull request Jan 15, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature new functionality including changes to functionality and code refactors, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants