-2

I have one main domain basicdomain.com;

About 100 domains's CNAME are pointing to that main domain.

domain1.com, domain2.com, ... domain100.com

All domains will show basicdomain.com contents.

I am using AWS S3 for assets storage and I set basicdomain.com 's CNAME to point to s3.amazonaws.com.

So when I hit basicdomain.com/directory/filename.png it is showing AWS S3 's image s3.amazonaws.com/directory/filename.png.

And for other urls in basicdomain.com, it worked well as normal.

Problem: I want to see AWS S3 image when I hit domain1.com/directory/filename.png. When I hit that, it shows 404 error.

Is there any solution for this? If It can be done without changing CNAMEs for 100 domains, that's what I want.

LoveCoding
  • 109
  • 4
  • You are mixing two things: DNS level configuration, and HTTP level configuration. The DNS part only deal with names and IP addresses. After which the receiving server must be configured to accept the name that was used at the beginning of the resolution: you can not map (using CNAME) any arbitrary name to any webserver existing and expect it to work: the webserver has to be configured to recognize the name. In your case you seem to need more something akin to a proxy. So you would both need to change your records (to point to some other host you control) and install a webserver there. – Patrick Mevzek Jun 01 '20 at 01:02

1 Answers1

0

CNAMEs can be very tricky to use because AWS' setup is a bit different. The preferred way is to use aliases and A names. Change one of your domains to an A record and test if that works. Try not to use CNAMEs on AWS.

Chris
  • 318
  • 1
  • 5