github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/outputs/http_server.md (about) 1 --- 2 title: http_server 3 type: output 4 status: stable 5 categories: ["Network"] 6 --- 7 8 <!-- 9 THIS FILE IS AUTOGENERATED! 10 11 To make changes please edit the contents of: 12 lib/output/http_server.go 13 --> 14 15 import Tabs from '@theme/Tabs'; 16 import TabItem from '@theme/TabItem'; 17 18 19 Sets up an HTTP server that will send messages over HTTP(S) GET requests. HTTP 2.0 is supported when using TLS, which is enabled when key and cert files are specified. 20 21 22 <Tabs defaultValue="common" values={[ 23 { label: 'Common', value: 'common', }, 24 { label: 'Advanced', value: 'advanced', }, 25 ]}> 26 27 <TabItem value="common"> 28 29 ```yaml 30 # Common config fields, showing default values 31 output: 32 label: "" 33 http_server: 34 address: "" 35 path: /get 36 stream_path: /get/stream 37 ws_path: /get/ws 38 allowed_verbs: 39 - GET 40 ``` 41 42 </TabItem> 43 <TabItem value="advanced"> 44 45 ```yaml 46 # All config fields, showing default values 47 output: 48 label: "" 49 http_server: 50 address: "" 51 path: /get 52 stream_path: /get/stream 53 ws_path: /get/ws 54 allowed_verbs: 55 - GET 56 timeout: 5s 57 cert_file: "" 58 key_file: "" 59 cors: 60 enabled: false 61 allowed_origins: [] 62 ``` 63 64 </TabItem> 65 </Tabs> 66 67 Sets up an HTTP server that will send messages over HTTP(S) GET requests. If the `address` config field is left blank the [service-wide HTTP server](/docs/components/http/about) will be used. 68 69 Three endpoints will be registered at the paths specified by the fields `path`, `stream_path` and `ws_path`. Which allow you to consume a single message batch, a continuous stream of line delimited messages, or a websocket of messages for each request respectively. 70 71 When messages are batched the `path` endpoint encodes the batch according to [RFC1341](https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html). This behaviour can be overridden by [archiving your batches](/docs/configuration/batching#post-batch-processing). 72 73 ## Fields 74 75 ### `address` 76 77 An optional address to listen from. If left empty the service wide HTTP server is used. 78 79 80 Type: `string` 81 Default: `""` 82 83 ### `path` 84 85 The path from which discrete messages can be consumed. 86 87 88 Type: `string` 89 Default: `"/get"` 90 91 ### `stream_path` 92 93 The path from which a continuous stream of messages can be consumed. 94 95 96 Type: `string` 97 Default: `"/get/stream"` 98 99 ### `ws_path` 100 101 The path from which websocket connections can be established. 102 103 104 Type: `string` 105 Default: `"/get/ws"` 106 107 ### `allowed_verbs` 108 109 An array of verbs that are allowed for the `path` and `stream_path` HTTP endpoint. 110 111 112 Type: `array` 113 Default: `["GET"]` 114 115 ### `timeout` 116 117 The maximum time to wait before a blocking, inactive connection is dropped (only applies to the `path` endpoint). 118 119 120 Type: `string` 121 Default: `"5s"` 122 123 ### `cert_file` 124 125 An optional certificate file to use for TLS connections. Only applicable when an `address` is specified. 126 127 128 Type: `string` 129 Default: `""` 130 131 ### `key_file` 132 133 An optional certificate key file to use for TLS connections. Only applicable when an `address` is specified. 134 135 136 Type: `string` 137 Default: `""` 138 139 ### `cors` 140 141 Adds Cross-Origin Resource Sharing headers. Only valid with a custom `address`. 142 143 144 Type: `object` 145 Requires version 3.63.0 or newer 146 147 ### `cors.enabled` 148 149 Whether to allow CORS requests. 150 151 152 Type: `bool` 153 Default: `false` 154 155 ### `cors.allowed_origins` 156 157 An explicit list of origins that are allowed for CORS requests. 158 159 160 Type: `array` 161 Default: `[]` 162 163