-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Setting the origin of the request #69
Comments
I added the Origin header recently to solve a problem for a user, but you are right that it probably should be configurable. There is a feature to add custom headers to the request, but that will result in duplicate Thanks, Gil. |
Hi, What needs to be done: handshake += "Origin: https://github.com/gilmaimon/TinyWebsockets\r\n"; will only get executed if This is my opinion and it is open for discussion and contribuation. Thanks, |
Hi, thanks for the reply. I have created a PR #74 but it is untested as for now. (I need to create a websocket server first). I will update the PR and this issue post as soon as I see if it's working. Edit: I had gone with the 2nd method you had written. Rather than creating a method for every header type, this firstly writes the user-created headers and then it adds default headers if they're not declared. |
Update: This was tested on an ESP8266 (NodeMCU 1 copy) and I was able to successfully overwrite the client.addHeader("Origin", "https://localhost");
client.connect(websocketUrl); When I didn't write the |
Awesome, the PR was merged and I will publish a version in a few moments. Thank you! |
Oh and @gilmaimon could you add me to the contributor list in README as well? Thanks in advance! |
Not really an issue but would be an awesome upgrade. I've tested the websocket client on my server in production and I get the following (you can skip after the block of code, I'll provide a TL;DR):
Basically the issue is that the origin is
https://github.com/gilmaimon/TinyWebsockets
and I need to add it to the accepted origins in my app. It would be awesome to make it configurable.The text was updated successfully, but these errors were encountered: