February 26, 2023, 10:19pm
I have setup a web server with nginx and want to access one of my workers through the proxy feature nginx supports. When i add the worker url in the proxy pass and try to access through nginx server domain it gives
403 forbidden and 421 Misdirect Error.
Any assitance or suggestions are appreciated.
Is nginx throwing an error or is the worker?
February 27, 2023, 4:24am
@Cyb3r-Jak3 Thank you for reply.
The nginx seems to be connecting with Worker, i also tested the proxy config with
example.com domain and it works but not with the worker domain.
The nginx config is:
proxy_set_header Host myworker.example.workers.dev;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
I have used this example code on the worker:
February 27, 2023, 7:10am
Let me know, if
@Cyb3r-Jak3 need more information regarding with config or the setup.
February 27, 2023, 8:06am
Here is a reference link, which i am testing this project on:
Right now its proxing through a test site, and if you
http://test/cf-worker, it has configured to proxy https://test.proxy-cf-worker.workers.dev/
But instead gives
502 Bad Gateway.
February 27, 2023, 10:28pm
I was testing it with some other domain, try now.
Ah yeah, I see the error now. What do the nginx error logs show?
February 27, 2023, 10:40pm
The error logs seems to be clear, let me share you the server details for you to investigate:
the nginx config file: /etc/nginx/sites-available/proxy
February 27, 2023, 11:12pm
Even if this link is single use, it’s
very strongly discouraged to share credentials.
Please. refrain from doing so here, nor anywhere else.
I opened the link to break it for everyone else. I am not going to log in into a random server. I’ll try and recreate this locally to get it to work.
Can you try setting
proxy_ssl_server_name on; in your
location block? I know when I was doing nginx and R2 you need this, otherwise nginx makes a request to the IP address which Cloudflare blocks.
February 28, 2023, 12:27am
It Worked, Cyber, the proxy passed, thank you for the assitance.
That seems to be a nginx problem, not related to Cloudflare. You should check out
Server Fault for those types of questions.
March 3, 2023, 12:49am
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.