Websocket proxy 403 error

Hi. We are using spring cloud gateway websocket proxy to attach our internal authentication service, but when accessing ethereum network through spring cloud gateway, I keep getting 403 error. I want to know what is the cause.

Works fine when just connect without the spring cloud gateway.

Thank you

spring cloud gateway application.yaml:

spring:
  main:
    allow-bean-definition-overriding: true
  profiles: default
  datasource:
    driverClassName: org.h2.Driver
    url: jdbc:h2:mem:testdb
    username: test
    password: test
    platform: postgres
  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
  jackson:
    serialization:
      WRITE_DATES_AS_TIMESTAMPS: false
  cloud:
    gateway:
      enabled: true
      routes:
        - id: ropsten-infura-ws
          uri: wss://mainnet.infura.io/ws/v3/<<my-token-id>
          predicates:
            - Path=/ethereum/ropsten-infura-ws

server:
  port: 8080

eureka:
  client:
    enabled: false

app:
  datasource:
    maximum-pool-size: 100

Welcome @junbeom_lee! Without seeing more of your code, I would double check that you are using the correct Project ID in your configuration and that any whitelists you have configured match your specifications. If the requests you are sending don’t match your configured whitelists you would be getting a 403 https://infura.io/docs/gettingStarted/whitelisting

Any additional debug response data would be helpful. It may also be related to the spring proxy you are running depending on what headers it is passing through.

Thank you for the answer. The reason is that when the http request is sent through the spring cloud gateway, the host value is set to the gateway host in the request header.
After i removed host value in request header, it worked!!

Glad that resolved your issue! Please don’t hesitate to reach out if you have any other issues.