hoppscotch-backend
hoppscotch-backend copied to clipboard
WSS 400 Error
I have properly configured the backend service but when the front end tries to establish a WSS connection, it gets a 400 error. I also tried to connect to "wss://localhost:8989/graphql/ws" using Postman but still getting Error: Unexpected server response: 400.
Can you please help?
I changed environment: "production" to environment: "development" and it started working perfectly. Is the production setting not supported?
When you use environment development, it will allow CORS request from any domain. The fix would probably be setting environment to production and configuring the setting allowed_domains correctly.
api:
port: "8989"
# development/production/test
environment: "production"
ssl:
enabled: false
certificate: "/etc/api-config/ssl.crt"
key: "/etc/api-config/ssl.key"
database:
username: "hoppscotch"
password: "hoppscotch"
database: "hoppscotch"
host: "localhost"
port: "3306"
driver: "mysql"
debug: true
allowed_domains: # This is to allow CORS to do it's magic.
- "https://hoppscotch.example.com"
- "https://api-hoppscotch.example.com"
The first domain is the frontend domain and the second one is the backend API domain. Just changing production to development makes things work perfectly. Nothing else I change.
At this moment I would not know what would cause that, since the only thing the environment changes is the logging and enabling CORS.