REST API无法正常工作,并使用https / ssl重定向

I have build and application with angular 5 and REST API with golang and hosted them on aws ec2 instance, I have installed ssl certificate to run the app and api on https. following is my url structure to run app and api ( api is running on 8080 port

app : https://mysite.maindomain.com api : https://mysite.maindomain.com:8080

When I hit api after setting up the ip in host file on system it works fine but its not working with aws and redirects to https://mysite.maindomain.com:8080 when I hit any api like https://mysite.maindomain.com:8080/signup or https://mysite.maindomain.com:8080/get-user/10

Nor sure what is the issue here but everything else is working fine

I am using gin gonic as go framework and also have used RunTLS as recommended.

Not sure I fully appreciate the issue, but just in case, have you setup CORS on the API server (https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).

If you run a browser application served from ORIGIN1, and the browser tries to access an API on DESTINATION2, the API server must state to the browser that it is indeed authorized to reply to a browser originating from ORIGIN1.

You can for example use https://github.com/gin-contrib/cors to add CORS support to your API server. Good luck.