Skip to content

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

Closed

Description

@ITJamie

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

Activity

  1. added
    Feature
    on Oct 14, 2021
  2. added this to the Approved milestone on Oct 18, 2021
  3. removed their assignment
    on Oct 18, 2021
  4. johnnybubonic commented on Jan 27, 2022

    @johnnybubonic

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

  5. goapunk commented on Apr 6, 2022

    @goapunk

    Same, this would be very useful

  6. rfilgas-apex commented on Oct 17, 2022

    @rfilgas-apex

    This would be useful for using nexus as well.

  7. Gulluth commented on Feb 15, 2023

    @Gulluth
    Contributor

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

  8. dithmer commented on Aug 30, 2023

    @dithmer

    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.

  9. jdelic commented on May 7, 2024

    @jdelic
    Contributor

    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 🙃

  10. added a commit that references this issue on May 7, 2024
  11. locked and limited conversation to collaborators on Feb 5, 2025
  12. converted this issue into a discussion #67675 on Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions