You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/automatic-platform-optimization/reference/subdomain-subdirectories.mdx
+14-19Lines changed: 14 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,6 @@ title: Subdomains and subdirectories
3
3
pcx_content_type: how-to
4
4
sidebar:
5
5
order: 14
6
-
7
6
---
8
7
9
8
## Run APO on a subdomain
@@ -36,24 +35,20 @@ If you choose to run APO only on a subdirectory, the rest of the domain should b
36
35
The `cf-edge-cache: no-cache` instructs the APO service to bypass caching for non-WordPress parts of the site. You can implement this option with Cloudflare Workers using the example below.
37
36
38
37
```js
39
-
addEventListener('fetch', event=> {
40
-
event.respondWith(handleRequest(event.request));
41
-
});
42
-
43
-
asyncfunctionhandleRequest(request) {
44
-
/**
45
-
* Response properties are immutable. To change them, construct a new
46
-
* Response object. Response headers can be modified through the headers `set` method.
47
-
*/
48
-
constoriginalResponse=awaitfetch(request);
49
-
50
-
let response =newResponse(originalResponse.body, originalResponse);
Copy file name to clipboardExpand all lines: src/content/docs/images/transform-images/control-origin-access.mdx
+63-60Lines changed: 63 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,23 +3,20 @@ pcx_content_type: reference
3
3
title: Control origin access
4
4
sidebar:
5
5
order: 24
6
-
7
6
---
8
7
9
8
You can serve resized images without giving access to the original image. Images can be hosted on another server outside of your zone, and the true source of the image can be entirely hidden. The origin server may require authentication to disclose the original image, without needing visitors to be aware of it. Access to the full-size image may be prevented by making it impossible to manipulate resizing parameters.
10
9
11
10
All these behaviors are completely customizable, because they are handled by custom code of a script running [on the edge in a Cloudflare Worker](/images/transform-images/transform-via-workers/).
This code will be run for every request, but the source code will not be accessible to website visitors. This allows the code to perform security checks and contain secrets required to access the images in a controlled manner.
@@ -28,27 +25,27 @@ The examples below are only suggestions, and do not have to be followed exactly.
28
25
29
26
:::caution[Warning]
30
27
31
-
32
28
When testing image transformations, make sure you deploy the script and test it from a regular web browser window. The preview in the dashboard does not simulate transformations.
33
29
34
-
35
30
:::
36
31
37
32
## Hiding the image server
38
33
39
34
```js
40
35
asyncfunctionhandleRequest(request) {
41
-
constresizingOptions= {/* resizing options will be demonstrated in the next example */}
0 commit comments