Caching is not working properly

a year ago

I recently asked if I could write my own cdn for my website : https://discord.com/channels/713503345364697088/1312083597397852220 . I implemented it for myself and locally it works just fine. But in production I have already encountered the problem that from backend to cdn request is blocked and throws 403 error (see screenshot) although service-key is correct.

The first time I had to deal with this problem for a very long time, I rewrote a lot of code from backend to cdn and could not understand what the problem was. In the end I realized that the problem is in cloudflare that it somehow does not work like that and stopping it for the site - everything began to work as it should.

Now I made a second attempt, I added a new rule for Cache Rules to not cache the domain cdn.netrix.fun, but this again did not help and sending a request from the backend - I still get a 403 error, and in the logs cdn this failed request is not even displayed (see the second screenshot).

I also tried to add an icon directly via Postman, I made a post request and the icon was successfully saved on cdn, but if I want to go to the url of the saved icon - I immediately get a 404 error that the file was not found.

I honestly do not know what to do.

9 Replies

a year ago

49c5f0bc-621a-4388-8576-9a3edb59e080


a year ago

Even now having stopped the cdn - I successfully sent a request to the backend - on the logs I saw that I got 201 code, that is the file was created and I follow the file link - and still get a 404 error.

Although when I make a request through Postman, absolutely at the same url - I get everything correctly

1315330039138619400
1315330039662772200


a year ago

Okay, it's been a little while longer since I stopped cloudflare and now everything is working correctly. If I restart it, everything will crash again.


a year ago

Hi, i'm sorry but we are unable to provide coding help here as that 403 is returned by your app, not the Railway platform.


a year ago

Yeah, I realize that. I just thought that since railway interacts with cloudflare to at least be able to use its domain - maybe you know what the problem is and why cloudflare does not allow to make a request from backend to cdn


a year ago

Railway doesn't interact with Cloudflare though, you interacted with Cloudflare yourself to set up the domain


a year ago

Well, yes, I do, but I meant that Railway is the one that gives out the CNAME to be entered into the DNS on cloudflare.


a year ago

Anyway, I guess I should take this cloudflare setup problem somewhere else.


a year ago

Sorry we couldn't help, perhaps ask in a programming help community


Loading...