0

The following server with Nginx version 1.22.1:

server { listen 80; server_name ip; location /getthe/ { set $target_url $arg_url; if ($target_url = "") { return 400 "No target URL specified"; } proxy_pass $target_url; } } 

When I enter the site into my browser, http://192.168.4.27/getthe/?url=http://example.com, a "502 bad gateway" page comes up.

Also, when I replace proxy_pass with just http://example.com the reverse proxy works fine.

I tried resetting and reinstalling Nginx, but the issue persists. I expect the URL from the URL parameter to be reverse proxied and displayed to the user.

2
  • You'll need to define a resolver for this configuration to work (you can read this post to find out why is it required). If you check the nginx error log, you'll see a clear error message "no resolver defined to resolve example.com..." Commented Nov 24, 2024 at 22:23
  • Ah ok. Thanks!! Commented Nov 24, 2024 at 22:35

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.