Cloud interface cannot request objects in behavior

I have set up cloudfront, elb and my ec2 web server for default behavior (no caching), everything works fine. There is only 1 source (elb), and the path of origin is empty. Now I want to cache static things with a cloud cloud from a web server (wildfly), for example js / css, all of them are served in the / my -context / assets folder

So, I am adding a new behavior with the path template / my -context / assets / * 'and the default cache settings using the same source. This does not work, my login page returns the html page itself, but all css / js failed. Request / my -context / assets / a / b / some.css return 502 with "CloudFront could not connect to the source."

I also tried to establish a new origin (with the same elbow) using the path "/ my-context / assets" for the new behavior, it also fails.

Can I get instructions on how to make this work? or does it really not work?

Thanks!

+2
source share
1 answer

The solution is to configure the cache behavior to forward (white list) the header Host:to the origin from the incoming request.

This does not mean that this is the β€œcorrect” configuration in each case, but many times it is desirable or even required.

CloudFront https- , , , ( , , ), , CloudFront.

CloudFront HTTPS , :

& ; , Origin .

& ; CloudFront , .

SSL/TLS " " , , " ". (CloudFront .) , , , CloudFront 502 (Bad Gateway) ,

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/SecureConnections.html#SecureConnectionsHowToRequireCustomProcedure

CloudFront , CloudFront , .

, , , , , , , , Host: ( CloudFront " " ), CloudFront, , , .

Host:, , , , -, . Host: , CloudFront - , , , , .

( CloudFront HTTPS- ), CloudFront , , , , , , TLS/SSL ( , , ).

+1

Source: https://habr.com/ru/post/1611696/


All Articles