gatus
gatus copied to clipboard
feat: Allow custom origin header for Websocket
Summary
The issue described in https://github.com/TwiN/gatus/issues/641#issuecomment-1980446434 was caused by an hardcoded origin header at https://github.com/TwiN/gatus/blob/1e431c797ad265b43269d1dfe270f1acd37d24fa/client/client.go#L265 which got validated by the websocket server and returend 403 (bad status
, from https://github.com/golang/net/blob/ab271c317248ea0f18481852f96d12d5eca05cf8/websocket/hybi.go#L440-L445)
This PR allows to customize the origin header.
Example
endpoints:
- name: websocket
url: "wss://example.org"
interval: 10s
headers:
Origin: "http://gatus.example.org"
conditions:
- "[CONNECTED] == true"
Fixes #641
Checklist
- [X] Tested and/or added tests to validate that the changes work as intended, if applicable.
- [ ] Updated documentation in
README.md
, if applicable.