Implementing Worker Rules: Unable to achieve desired response Header (Example Provided)


#1

Hi Fellow Devs.
I’m new to the CloudFlare system and I’m looking for a little guidance for implementing and writing a worker to achieve the Response Header below. I have spent some time exploring and trying to implement a worker, but have been having difficult implementing and achieving the response Headers that worked prior to mitigating my system through CloudFlare for optimisation and performance reasons.

These are for a post request a file location structure: https://mydomainplaceholder/aaa/bbb/
I have multiple files at bbb directory that holder the authentication information for that is used when posting the data into my database which is carrying a payload JSON structure that should be updated into the database during the post request.

Would be also very helpful is someone could quickly explain whole workflow process for implementing the worker too. I want to use CloudFlare functionality as a cheaper long-term up-scaling solution, so I want to implement a permanent solution that doesn’t rely on the underlining system settings on my hosting server. (I don’t want to disable Cloudflare feature to pass server setting through the https:// path) - Hopefully that makes a little sense. :confused:

==================================
| Response Headers (EXPECTED) |

access-control-allow-headers: Content-Type,X-Session-Token,X-Directive
access-control-allow-methods: GET,POST,PUT,DELETE
access-control-allow-origin: *
cache-control: max-age=0, private, must-revalidate
cf-ray: #############-####
content-encoding: br
content-type: application/json; charset=utf-8
date: ###
etag: ############################
status: 200
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-request-id: ############-##########-##########
x-rt: api
x-runtime: 0.067331
x-xss-protection: 1; mode=block

==================================
| Response Headers (CURRENT) |

accept-ranges: bytes
age: 0
cf-ray: #############-####
content-length: 599
date: ###
expect-ct: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
last-modified: ###
server: cloudflare
status: 200
x-cache: MISS
x-varnish: ########

Any additional material would be helpful.

Thank you for taking the time to read my post~ (Hopefully it isn’t too bothersome). List any addition CloudFlare service I may require to achieve my desired results (If I’m missing anything? Based off what I have read: It should be easily* achieve via Helpers?)

I’m a solo developers so I don’t have other workers to fallback on for advice or guidance :sweat: Any and all advice helps!!


#2

I resolved the problem. Just needed to do some experimentation to understand the workflow