Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

APIGEE - Websocket endpoint returns 400

Hello,

I have been using APIGEE (on GCP) as a reverse proxy for restAPI for our Organization and have had a positive experience. I wanted to use the same for a web app developed using streamlit however, I am facing an issue with Websocket.

The app is hosted in Cloud run and when I access it with the CR URL without any issues. The websocket link is something like 
wss://cloud.run.url/_stcore/stream/.

However, when I try to access the same via apigee, it returns 400 Bad Request.

I have gone through all the relevant questions raised in the community and also watched the video https://www.youtube.com/watch?v=TrGftwcI-Ps&t=8s by @dchiesa1 but just cannot get this thing to work. However, the other links returns 200, 304 which is expected behaviour.


Solved Solved
0 2 316
1 ACCEPTED SOLUTION

Hello @hartmann 

Thanks for your reply. After trying various policies and different properties, I decided to create a new proxy this morning with just the following properties in the HTTPTargetConnection which has done the trick:

<Properties>
  <Property name="response.streaming.enabled">true</Property>
</Properties>

 Earlier, I also had the following properties which were causing some issues, I guess (I am not sure though):

<Properties>
  <Property name="keepalive.timeout.millis">600000</Property>
  <Property name="connect.timeout.millis">600000</Property>
  <Property name="io.timeout.millis">600000</Property>
</Properties>

Anyway, it works now.

 

View solution in original post

2 REPLIES 2

Hello,

To be able to assist further, we would need a few more details:

1. Where is the bad request being returned? For example, is it returned at the Apigee request layer, Cloud Run layer (ie: target service invocation), etc?

2. Are there any other details in the error message besides the bad request status code (logging in the Apigee debug panel and the Cloud Run service would be helpful here)?

3. Have you been able to successfully connect to the Cloud Run service via any third party API client (ie: Postman, cURL, etc) besides directly connecting via browser? If yes, have you validated all pertinent details between the requests match to expectation (ie: header information, etc)?

Thanks! 

Hello @hartmann 

Thanks for your reply. After trying various policies and different properties, I decided to create a new proxy this morning with just the following properties in the HTTPTargetConnection which has done the trick:

<Properties>
  <Property name="response.streaming.enabled">true</Property>
</Properties>

 Earlier, I also had the following properties which were causing some issues, I guess (I am not sure though):

<Properties>
  <Property name="keepalive.timeout.millis">600000</Property>
  <Property name="connect.timeout.millis">600000</Property>
  <Property name="io.timeout.millis">600000</Property>
</Properties>

Anyway, it works now.