My situation is as follows: I have an ec2 server with traccar server installed and properly working, I already have a load balancer, ssl certificate, reverse proxy, and the api runs perfectly on that server. I'm creating a react js project with vite that will be hosted on AWS Amplify. Locally my frontend project executes the following information:
server: {
port: 3000,
proxy: {
'/api/socket': 'ws://api.server.com.br',
'/api': 'https://api.server.com.br',
},
},
this works locally, at localhost:3000/api
-> returns api data and the socket at /api/socket.
In amplify there is Rewrites and redirects, I have already made the following configuration:
/api/<*>
-> redirects to -> https://api.server.com.br/api/<*>
/api/socket
-> redirects to -> ws://api.server.com.br/api/socket
,
both are type 200 (Rewrite).
In amplfy it's not working, do you know how to help me?
Shouldn't it be wss://
instead of ws://
?
I solved it by implementing the build on the same server. your solution is incredible, thank you and congratulations.
My situation is as follows: I have an ec2 server with traccar server installed and properly working, I already have a load balancer, ssl certificate, reverse proxy, and the api runs perfectly on that server. I'm creating a react js project with vite that will be hosted on AWS Amplify. Locally my frontend project executes the following information:
this works locally, at
localhost:3000/api
-> returns api data and the socket at /api/socket.In amplify there is Rewrites and redirects, I have already made the following configuration:
/api/<*>
-> redirects to ->https://api.server.com.br/api/<*>
/api/socket
-> redirects to ->ws://api.server.com.br/api/socket
,both are type 200 (Rewrite).
In amplfy it's not working, do you know how to help me?