Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c-rack/plug_response_header
Elixir Plug to manipulate HTTP response headers
https://github.com/c-rack/plug_response_header
Last synced: 2 months ago
JSON representation
Elixir Plug to manipulate HTTP response headers
- Host: GitHub
- URL: https://github.com/c-rack/plug_response_header
- Owner: c-rack
- License: apache-2.0
- Created: 2015-04-14T20:25:21.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-07T11:20:17.000Z (over 9 years ago)
- Last Synced: 2024-11-01T07:33:26.643Z (3 months ago)
- Language: Elixir
- Size: 184 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - easy manipulation of HTTP response headers. (Framework Components)
- fucking-awesome-elixir - plug_response_header - easy manipulation of HTTP response headers. (Framework Components)
- awesome-elixir - plug_response_header - easy manipulation of HTTP response headers. (Framework Components)
README
# PlugResponseHeader [![Hex.pm Version](http://img.shields.io/hexpm/v/plug_response_header.svg)](https://hex.pm/packages/plug_response_header)
This [Elixir](http://elixir-lang.org/) [plug](https://github.com/elixir-lang/plug) allows manipulation of [HTTP](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol) response headers:
* Deleting one or more HTTP response headers.
* Setting one or more HTTP response headers.
* Setting the HTTP "Server" response header.This plug supports the following options. At least one option must be specified.
* `delete`: a bitstring or a list of bitstrings of header keys to be deleted.
* `server`: convenience function for `set: ["server": "MyServer"]`
* `set`: a list of key/value pairs for headers to be set.## Setup
To use the plug in your projects, edit your mix.exs file and add the project as a dependency:
```elixir
defp deps do
[
{:plug_response_header, "~> 0.2.1"}
]
end
```## Usage
```elixir
pipeline :browser do
plug PlugResponseHeader,
delete: "x-request-id",
server: "MyServer",
set: [
"strict-transport-security": "max-age=31536000",
"cache-control": "no-transform"
]
...
end
```## License
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)