Cloudflare works on both main and sub domain

caching

#1

Hi there

I have a main domain and a sub domain up running with Cloudfare before and i found that my website of my sub-domain has so many problem.

Case:
Origin server: Godaddy Business plan
Purchased SSL from Godaddy already so i select “Full” mode in Crypto.
Changed name server from Godaddy to Cloudflare successfully.

Problem:
I have a login function in my sub-domain. Everytime i tried to login, the sub-domain website prompts me a message telling i am logging in successfully. After that the page re-direct me back to the page where i perform the login function, and the problem comes, the website has just not logged in, it remains logged out status.

Any people can tell what have i gone wrong? Could i just disable CDN function to my sub-domain? Please guide me through, many thanks!


#2

I think what you are looking for is to bypass caching on the subdomain (or subdomain and page) that you use for logging in, and that can be managed with a Page Rule. This video is focused toward WordPress, but the same logic applies for any login pages. If you want to skip ahead the login stuff is at about 2:48 in.

You can up the security for the login page, while also bypassing cache so your logged in status isn’t cached incorrectly.


#3

Thanks Ryan. Before reading your message, i have solved the problem on my sub-domain by setting page rule to bypass Caching . And it works perfectly.

However, i have encountered another problem on my main domain which is a Wordpress website with membership function. I set “Cache everything” in my page rule and it really hurts the login functionality of my website. Whenever i hit login, it did login and redirecting me to my admin dashboard, however, when i go back to my homepage or any other page, the site logged out.

I put many effort to search on web about this problem and i conclude that this problem is actually coming from the “Cache everything” setting in my page rule. All things back to normal when i select “Standard” Cacheing.

I read another Thread here, and many people are saying in order to solve this problem we have to go for the business plan because we can bypass cookies under this plan.

My question is, it is true?

Many thanks!


#4

It’s true.


#5

Yes, the Bypass Cache on Cookie Page Rule setting is only available on Business and Enterprise plans.

However… using ‘Cache Everything’ with WordPress admin (wp-admin) is not recommended. In fact we recommend creating a Page Rule specifically for wp-admin with the setting ‘Cache Level: Bypass’ in addition to some other settings to disable Apps and Performance. This Page Rule is outlined in the video link that Ryan provided above. You can use this Page Rule in conjunction with another rule set to cache everything for other paths, etc.

Note: Once a URL matches a rule, only that rule only will be applied - ie. if a Page Rule has already triggered on a request, any subsequent rules that also match the URL pattern will not take effect. As a general rule, we recommend ordering your rules from most specific to least specific.


#6

Thanks guys!