403 forbidden Cloudflare after attempting set up cache in nginx

Hey there,

Apologies if this sounds like a novice question I’m new to all this. I’m trying to host my first website with Nginx and implementing caching to speed up image loading. However, after attempting to set up cache, I’m encountering a persistent 403 Forbidden error from Cloudflare. Any insights on how to tackle this issue would be greatly appreciated!

    proxy_ssl_server_name on;
    proxy_ssl_name $proxy_host;

    location / {
        try_files $uri $uri/ /index.html /index.php$is_args$args;

	proxy_pass https://example.de;
        proxy_cache custom_cache;
        add_header Cache-Control "public, max-age=3600, must-revalidate";

Hi there,

A generic 403 Forbidden error pages is a sign that your SSL/TLS handshake is failing a sanity check. This is generally because there is a different SNI (Server Name Indication) and HTTP header mismatch.

I can see you are looking to utilizing proxy_pass in nginx - is there any requirement in your configuration to be using porxy_pass ?

From your description of what you’re trying to achieve, proxy pass should not be required and this could be causing the mismatch if it is not configured correctly. I’d try removing that configuration and test again.

DigitalOcean have a great guide for setting up what your trying to do I believe - How To Install Nginx on Ubuntu 20.04 | DigitalOcean

Hope this helps!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.