diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 6d757ce..ba68760 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -29,6 +29,11 @@ class Pterodactyl(commands.Cog): base_url = await self.config.base_url() api_key = await self.config.api_key() server_id = await self.config.server_id() + + extra_headers = { + "Origin": base_url + } + try: client = PterodactylClient(base_url, api_key).client websocket_credentials = client.servers.get_websocket(server_id) @@ -40,7 +45,7 @@ class Pterodactyl(commands.Cog): self.logger.error(f'Failed to retrieve Pterodactyl websocket: {e}') return - async with websockets.connect(websocket_credentials['data']['socket']) as websocket: + async with websockets.connect(websocket_credentials['data']['socket'], extra_headers=extra_headers) as websocket: self.logger.debug("WebSocket connection established") # Send authentication token