How to use Https on a web server(Java spring boot)

0

I haven't configured anything yet in my spring boot app for https(didnt find any video on it). I uploaded my angular web app to s3 bucket, and registered a route 53 domain for it and linked it to a cloudfront after providing a public certificate for it from ACM. I also uploaded my java spring boot web server to Elastic beanstalk and integrated it with my web app. When i try to connect to my web app directly from s3 bucket, the web app and the web server server works perfectly fine over http, however when i try to access it from the registered domain, i can't send any http requests to my web server due to this: polyfills.92a50bbada1b2422.js:1 Mixed Content: The page at 'https://dormnation.link/homepage' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://dormnationsingleinstanceserver.eu-west-3.elasticbeanstalk.com/homepage/MainSearchEngine/LAU%20Beirut/Feb%202025/Feb%202025/1/default/0/default/false/false/0/0'. This request has been blocked; the content must be served over HTTPS.

And when i changed the request to https it just says below:

property-list.component.ts:135 GET https://dormnationsingleinstanceserver.eu-west-3.elasticbeanstalk.com/propertyList/q net::ERR_CONNECTION_TIMED_OUT . and : HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: 'Unknown Error', url: 'https://Dormnationsingleinstanceserver.eu-west-3.elasticbeanstalk.com/propertyList/q', ok: false, …} error : ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: 'error', …} headers : HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)} message : "Http failure response for https://Dormnationsingleinstanceserver.eu-west-3.elasticbeanstalk.com/propertyList/q: 0 Unknown Error" name : "HttpErrorResponse" ok : false status : 0 statusText : "Unknown Error" .

SO, can you please tell me how can i configure my public aws certificate in spring boot. Thanks in advance.

1 Answer
0

Hello. 

You are facing a mixed content issue with your web application when you tried to access with the registered domain. 

The cause of the mixed content error is because your application loaded over HTTPS (with the registered domain 'https://dorm***.link') requested contents from HTTP endpoint 'http://.eu-west-3.elasticbeanstalk.com/'. 

Since accessing HTTP contents from HTTPS-loaded workloads isn't considered as secure, these requests are blocked by modern web browsers. 

You shared that you tried to access the same endpoint with HTTPS, but you returned 'HttpErrorResponse' error from the endpoint. 

I would like to recommend you to refer documents from AWS Elastic Beanstalk and see If you can get some help first: 

'Configuring HTTPS for your Elastic Beanstalk environment [1]' 

'Configuring your Elastic Beanstalk environment's load balancer to terminate HTTPS [2]' 

Documents above I shared provide ways to configure HTTPS for EB environments, Load Balancers for EB environments' EC2 instances. 

If you want to have professional assistance from AWS, I would like to recommend you to open a support case via AWS Premium Support [3]. 

Regards, 

Myungsup Kwak 

References: 

[1] Configuring HTTPS for your Elastic Beanstalk environment 

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https.html 

[2] Configuring your Elastic Beanstalk environment's load balancer to terminate HTTPS 

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-elb.html 

[3] AWS Premium Support 

https://support.aws.amazon.com/#/contacts/aws-account-support 

profile pictureAWS
SUPPORT ENGINEER
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions