Home › Forums › WordPress Plugins › Hide My WP › HMYP & AWS CloudFront Custom Behaviours
- This topic has 6 replies, 2 voices, and was last updated 5 years, 4 months ago by dcipher.
-
AuthorPosts
-
May 29, 2019 at 1:57 am #26409dcipherPost count: 66
Dear Support,
I have a question regarding how custom behaviours would need to be configured in AWS CloudFront when using HMWP to hide certain paths such as wp-content, etc.
To explain my scenario, our website configured to completely hide behind AWS CloudFront, so the root domain and the www DNS records are all pointing to our CloudFront distribution. CloudFront has been configured with custom behaviours to handle certain requests differently, like for example, when a user accesses content that’s stored in the wp-content or wp-includes directories, CloudFront will cache those assets differently to those stored in wp-admin, and so on.
Now, if I enable HMWP and configure it to hide directories like those above, would I need to configure additional behaviours in CloudFront to include the new directory names that HMWP has given? (e.g. wp-content is called ‘other’ in HMWP, and so on).
I would like to ensure that my custom cacheing behaviours are maintained after HMWP has been enabled, just need your clarification on the topic.
Many thanks in advance.
May 29, 2019 at 3:05 am #26412Suman M.Post count: 12478Hi, are you using AWS? AWS by default do not enable htaccess. You will have to go into the Apache configuration file and change “AllowOverride None” to “AllowOverride All” to use the .htaccess file.
HMWP doesn’t physically rename any files and folders. It makes use of rewrite rules, so there should not be any issue. You can try applying “medium privacy more compatibility” settings scheme in HMWP start tab.
May 29, 2019 at 4:13 am #26413dcipherPost count: 66Hi Suman,
Yes I am using AWS however my instance is configured to use htaccess so I can confirm that mod_rewrite and htaccess are working.
I’m aware that HMWP only uses the the htaccess file to rewrite locations of files, however I need clarity on how CloudFront handles this.
Right now as an example, I have custom cacheing behaviours configured in CloudFront for static assets being served from wp-content/* directory, amongst others. Because a client’s browser accessing the site (through CloudFront) doesn’t technically see the URL structure because of how HMWP rewrites it, I want to know if CloudFront’s custom cacheing behaviours for those static assets still applies OR would I need to create additional behaviours now in CloudFront which reference the newly rewritten value that HMWP adds?
So current behaviour specifies wp-content/* as the origin path;
HMWP rewrites wp-content to ‘other’;
Do I need to create a new behaviour in CloudFront for origin path other/*?OR, should things just work!
Hope that’s clear.
May 30, 2019 at 6:03 am #26431Suman M.Post count: 12478So, do you have CloudFront CDN URL? If so then you’ll need to enter it in “CDN Path” field under General settings tab.
But you mentioned that it’s served via CloudFront only for static assets being served from wp-content/* directory. In that case please do not enter url in “CDN Path” field, you’ll need to add replacement in Replace Tools tab instead. I’ll help you with it. Please let me know the Cloudfront CDN url and your site url. Thanks!
August 2, 2019 at 8:24 am #27145dcipherPost count: 66Hi Suman,
I wanting to revive this thread because I don’t quite think we’re entirely aligned with the requirements. I’ll try to reiterate the specifics of my question.
Our site is only accessible through CloudFront. When you configure CloudFront, you also need to configure custom behaviours on how the CloudFront CDN handles specific paths.
Right now, I have a large list of custom behaviours including a few for the /wp-includes and /wp-content paths, configured in CloudFront which handle assets from these directories in a certain way.
Now, for example, HMWP is rewriting my wp-includes directory to /lib and my wp-content directory to /content. The question that I need answered is: Do I need to create custom behaviours in CloudFront that point to /lib and /content INSTEAD of the actual path of /wp-includes and /wp-content?
August 4, 2019 at 1:05 pm #27165Suman M.Post count: 12478Hi, you need not create custom behaviours in CloudFront for the renamed paths as the default WP paths will still be valid. HMWP doesn’t physically rename any files and folders.
August 5, 2019 at 6:05 am #27185dcipherPost count: 66Ok thanks Suman, that really helps.
Appreciate the reply.
-
AuthorPosts
You must be logged in to reply to this topic.