Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Why I can't to use CDN ???
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Why I can't to use CDN ???

noqqkknoqqkk Member

Contacted the support of CDN provider and he checked all my setting in DNS provider as well as the link in my website are also correct except the "Origin" in my CDN account.

I inputted domain.com in "Origin" but the support said the origin has a redirect, and returns a 301 moved permanently. This prevents caching. Therefore, CDN is not workable.

I inputted my IP address in "Origin" but the support said now returning a 502 Bad Gateway status code. Therefore, CDN is not workable.

So what should be inputted in "Origin" that can make the CDN work.

Below is listed my nginx setting and I think it may has something incorrect caused CDN not workable.

Anyone can help. Thanks.


Below is my setting in nginx.

(1) Disabled direct access to a web site by VPS ip address
(2) domain.com --- redirect ---> https://domain.com
(3) www.domain.com --- redirect ---> https://domain.com
(4) https://www.domain.com --- redirect ---> https://domain.com

Comments

  • contactwajeehcontactwajeeh Member
    edited May 2018

    I think you should use https://domain.com as origin and not just domain.com as that will cause a redirect from non-https to https hence you are seeing the 301 redirect.

  • FHRFHR Member, Host Rep

    What CDN are you using?

  • noqqkknoqqkk Member

    @contactwajeeh said:
    I think you should use https://domain.com as origin and not just domain.com as that will cause a redirect from non-https to https hence you are seeing the 301 redirect.

    They are not allow to input https://domain.com as origin.

  • drserverdrserver Member, Host Rep

    origin is domain.com now question is what did you set in your dns as domain.com ? is this possibly a CNAME ?

  • SplitIceSplitIce Member, Host Rep

    From my experience it's best to find out how the CDN identifies itself (e.g IP range, or HTTP header) and make sure that you don't do any of your redirects, or SEO tricks on those requests.

    You can also use this to make sure the CDN is restricted to the correct areas if you have authenticated areas (some CDNs pass cookies and can cache authenticated areas if a user is messing with you) or if you have large files etc that you don't want on your CDN bill.

    Thanked by 1noqqkk
  • noqqkknoqqkk Member

    @SplitIce said:
    From my experience it's best to find out how the CDN identifies itself (e.g IP range, or HTTP header) and make sure that you don't do any of your redirects, or SEO tricks on those requests.

    You can also use this to make sure the CDN is restricted to the correct areas if you have authenticated areas (some CDNs pass cookies and can cache authenticated areas if a user is messing with you) or if you have large files etc that you don't want on your CDN bill.

    Splitlce. Thanks for your information.

  • noqqkknoqqkk Member

    @drserver said:
    origin is domain.com now question is what did you set in your dns as domain.com ? is this possibly a CNAME ?

    A @ VPS-IP-Address
    A www domain.com
    CNAME img Domain-Name-Provided-by-CDN

  • drserverdrserver Member, Host Rep

    ok, some CDNs will not be happy if origin is CNAME.

    Thanked by 2noqqkk vimalware
  • DanSummerDanSummer Member
    edited May 2018

    @noqqkk said:

    @drserver said:
    origin is domain.com now question is what did you set in your dns as domain.com ? is this possibly a CNAME ?

    A @ VPS-IP-Address
    A www domain.com
    CNAME img Domain-Name-Provided-by-CDN

    It wouldn't work that way.
    First, you need to create a new A record that points to the same ip/folder. For example, you can call that abcdef.yourdomain.com ( just an example).

    Then in the CDN, you put that cname as the pullzone or origin.

    In your case I think it should be:

    A @ VPS-IP-Address
    A abcdef vps-ip-address
    CNAME www Domain-Name-Provided-by-CDN

    If you're using wordpress, make sure you turn off "Ignore Vary Header" (or something similar on your CDN), disable "Ignore Query Strings" and turn off "Disable Cookies" or something similar on your CDN else you'll not be able to login to wordpress.

    All files would be served through CDN using www.yourdomainname.com.

    Thanked by 1noqqkk
  • noqqkknoqqkk Member

    @DanSummer Many thanks for your help. I will try it and let you know the result. Thanks again.

  • @noqqkk said:
    @DanSummer Many thanks for your help. I will try it and let you know the result. Thanks again.

    Which CDN provider are you using? the setting could be a little different on that but the general rule is the same.

  • noqqkknoqqkk Member

    @DanSummer said:

    @noqqkk said:
    @DanSummer Many thanks for your help. I will try it and let you know the result. Thanks again.

    Which CDN provider are you using? the setting could be a little different on that but the general rule is the same.

    cdn.net

Sign In or Register to comment.