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.
resolverfor 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..."