This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I've encountered WebSocket issues in Laravel since Laravel 5, and it persisted through versions 9, 10, and now 11. The primary problem has always been getting WebSockets to run over WSS/HTTPS. | |
After numerous attempts, I found a solution to successfully run WebSocket over SSL. Here's how I did it. | |
Steps to Run WebSocket with SSL in Laravel | |
1. Generate SSL Certificates for your Domain or Host IP | |
First, generate the private key, CSR (Certificate Signing Request), and certificate for your domain (e.g., you-domain.net). | |
# Generate a private key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pm.sendRequest({ | |
url: pm.environment.get('APP_URL') + 'sanctum/csrf-cookie', | |
method: 'GET' | |
}, function (error, response, { cookies }) { | |
if (!error) { | |
pm.environment.set('XSRF_TOKEN', cookies.get('XSRF-TOKEN')) | |
} | |
}) |