Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket support. #1152

Merged
merged 2 commits into from
Jan 14, 2020
Merged

Websocket support. #1152

merged 2 commits into from
Jan 14, 2020

Conversation

eloycoto
Copy link
Contributor

@eloycoto eloycoto commented Jan 3, 2020

This commit adds the option to enable Websocket pass trough to the
upstream API if the original connection is a websocket connection.

Signed-off-by: Eloy Coto [email protected]

@eloycoto eloycoto requested a review from a team as a code owner January 3, 2020 15:51
@eloycoto eloycoto force-pushed the wss branch 3 times, most recently from d515851 to 0dfde01 Compare January 10, 2020 15:04
use lib 't';
use Test::APIcast::Blackbox 'no_plan';

repeat_each(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to run them twice?

[error]


=== TEST 2: Simple Websocket connection pass through
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests numbers are wrong starting from this one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, isn't this test checking the same as TEST 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's usingg ws url.

[error]


=== TEST 2: No websocket connection with policy does not change Upgrade header
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this test is duplicated.


function _M:rewrite()
if is_websocket_connection() then
ngx.var.upstream_connection_header = "Upgrade"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's reset on apicast.conf and this is to make sure that we set to Upgrade.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but why is this header not set by the application that calls apicast?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is set, but is overwritten by default here:

https://github.com/3scale/APIcast/blob/master/gateway/conf.d/apicast.conf#L88

So, the changes allow only to change that, just because is a websocket server.

This commit adds the option to enable Websocket pass trough to the
upstream API if the original connection is a websocket connection.

Fix THREESCALE-4019

Signed-off-by: Eloy Coto <[email protected]>
This commit add support to add wss protocol in the api_backend
definition, so users can define it easily.

Signed-off-by: Eloy Coto <[email protected]>
@eloycoto eloycoto merged commit f338ffc into 3scale:master Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants