rest-api-endpoints | : ear_of_rice : WordPress REST API endpoints | Content Management System library
kandi X-RAY | rest-api-endpoints Summary
kandi X-RAY | rest-api-endpoints Summary
:ear_of_rice: WordPress REST API endpoints
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- REST endpoint .
- Get menu items .
- REST API endpoint .
- Add social icon section .
- Get all required post data .
- Add the footer section .
- Get the required post data .
- REST endpoint .
- Get the posts .
- Register Post Endpoint
rest-api-endpoints Key Features
rest-api-endpoints Examples and Code Snippets
Community Discussions
Trending Discussions on rest-api-endpoints
QUESTION
I have set up a CloudFront on top of multiple S3 buckets (in different regions) to provide a fast stable version of my webapp. This webapp is implemented with React which means it's all one single HTML file and one single Javascript file.
Using the routing mechanism of React, all the paths in the URL are handled within the code. This means if I click on a link like www.example.com/users
, there won't be a request sent to the server. Instead, the client code will render the appropriate page without any consultation with the server (I'm just talking about the HTML and not considering the data). This means that if some user types in the given URL, the server should return the index.html
(the only HTML file I have) which then will take care of the URL on the client-side. In other words, all the requests sent to the server should either return the HTML file or the Javascript file I mentioned earlier. Even the requests that are pointing to none-existing files.
In order to implement this requirement, I asked this question and I got an answer like this:
I need to set up an error page for my distribution on CloudFront and redirect all the 403 (Forbidden) requests to
/index.html
file. This is because when the request is pointing to a nonexisting file on S3, S3 will return 403 to CloudFront due to the lack of listing permission. Or I can grant the listing permission and instead handle the 404 error (I didn't test this latter option).
Anyways, I set this up and it works perfectly - for a few hours. But then, for some unknown reason, the request to the Javascript file also returns the HTML file. And of course, all I'm getting back is actually coming from CloudFront's cache which means, no matter how many times I send the request, it will keep returning the same value. That is until I invalidate the cache on CloudFront which will solve the problem for few more hours. And we go around and around.
Even though I'm not sure why this happens but my guess is that at some point the S3 buck is inaccessible to CloudFront which will result in CloudFront caching the index.html
. What can I do about this?
ANSWER
Answered 2019-Feb-04 at 04:29I think I found the problem:
MAKE SURE YOUR STATIC CONTENT ON ALL THE S3 BUCKETS ARE IDENTICAL!!!
In my case, the Javascript filename is automatically generated by Webpack which means it's random. And since different regions were "compiled" separated, their filenames differed.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rest-api-endpoints
Clone the plugin directory in the /wp-content/plugins/ directory, or install a zipped directory of this plugin through the WordPress plugins screen directly.
Activate the plugin through the 'Plugins' screen in WordPress
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page