After introducing ALB (Application Load Balancer on AWS) in front of one EC2 instance, Chrome browser shows Mixed Content Error. (I edited the content of the error a little by security reason)
Mixed Content: The page at 'https://www.sample.com/talk' was loaded
over HTTPS, but requested an insecure EventSource endpoint
'http://www.sample.com/api/getData?param1=123¶m2=456'. This
request has been blocked; the content must be served over HTTPS.
Pattern1 has no errors.
Pattern2 shows the above error. I don't know where is a problem in my technology stack.
Pattern1: ALB(443) => EC2(443)
Pattern2: ALB(443) => EC2(80)
My tech stack:
ALB
Apache 2.4
Laravel 5.7
React 16.9
I tried the following solution but the error still happened.
- Trust Proxy of Laravel.
- HTTP request to server from React is written like relative path (/api/getData?param1=123¶m2=456) so I replace the code to absolute path specifying protocol and domain name (https://www.sample.com/api~).
- In Apache web server, rewrite http to https (I think this is bad idea).
Is this a general problem?
If you have any hints, please help me.
I'm sorry for my poor English.