0

I have an API under cloud run. My cloud run service is behind a Load Balancer.

I'd like to open a socket connection from my front end app to my API (wss protocol).
When I use the cloud run service url it works but when I use my custom domain name I receive an error "undefined" and the connection is closed immediately. There is no log, making it very difficult for me to debug.

As I want to limit my ingress permission to Allow internal traffic and traffic from Cloud Load Balancing I can't use the cloud run service url.

On my load balancer my front end is using HTTPS protocol.

I do not understand what is blocking my socket connection. Please ask for any details or further investigation. As I do not know where to begin my investigation I am having a hard time making a great post.

Update


If I connect using the cloud run url under allow all, it works, as I was saying. But I noticed another behavior. If I make a first connection using the cloud run url and then, try to connect using my custom domain url on the same browser. It works, whereas if I do the same operation on another browser or on a private window it fails with a 302 status code.

Update


So it appears that dis-activating IAP allow my front end to open a websocket connection to my API..

now I am trying to find a way to do the same but with IAP activated..

Thanks

Kimor
  • 532
  • 4
  • 17
  • You talked about custom domain. Do you talk about Load Balancer front end configuration? Or the Cloud Run custom domain feature? – guillaume blaquiere Oct 28 '21 at 18:04
  • Hello, I am working with a Load Balancer front end configuration. When I use the cloud run domain name with an 'Allow all' ingress, then my socket is working, but this is not my use case... – Kimor Nov 08 '21 at 09:32
  • Do another non socket endpoints work through the load balancer? – guillaume blaquiere Nov 08 '21 at 12:36
  • Yes everything works fine I can access my backend server without any issue – Kimor Nov 08 '21 at 12:53
  • 1
    Websockets do not support the HTTP Authorization Bearer header. That means you cannot use IAP with Websockets. https://stackoverflow.com/questions/4361173/http-headers-in-websockets-client-api/4361358#4361358 – John Hanley Nov 08 '21 at 18:19

0 Answers0