06/12/2024

Reverse proxy to webflow

Hosting

Hi all, I’m trying to set up an Nginx reverse proxy on my server: the root (test.th.pingpongx.com) should go to my Webflow site, and the /blog subdirectory should go to a blog service running on localhost:2368. This is my Nginx config:

server {
    listen 80;
    listen 443 ssl;
    server_name test.th.pingpongx.com;

    # ssl certificate config omitted

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://pingpong-global-1e24171df-6c9809fdac5ea.webflow.io;
    }

    location /blog/ {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:2368/;
        proxy_redirect off;
    }
}

With this setup, when I visit test.th.pingpongx.com, I see this error:
Fastly error: unknown domain: test.th.pingpongx.com. Please check that this domain has been added to a service.
According to my understanding, this is because I need to add test.th.pingpongx.com to Webflow as a production domain. When I do so, Webflow asks me to add a CNAME record pointing to proxy-ssl.webflow.io. However, once I have done that, I notice that test.th.pingpongx.com resolves to a Webflow-owned server rather than my own server, which means test.th.pingpongx.com/blog results in a 404 error despite my reverse proxy.

Am I missing something really obvious? Any suggestion would be appreciated.


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

2 replies
06/12/2024