K
K
kiranananda2019-02-19 21:02:01
Nginx
kiranananda, 2019-02-19 21:02:01

Nginx proxy to url from parameter?

Hello!
You need to proxy to the url that is specified in the request parameter. Here's what I'm trying but it doesn't work...

location / {
               proxy_pass $arg_url;
               add_header Access-Control-Allow-Origin *;
        }

in the url parameter, the whole url of what needs to be loaded...
https://bridge.mysite:4443/?url=ya.ru
As a result, an error
[error] 8#8: *1 invalid URL prefix in "ya.ru", client: 10.255.0.188, , request: "GET /?url=ya.ru HTTP/1.1"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-02-19
@kiranananda

location / {
    resolver 8.8.8.8;
    proxy_pass http://$arg_url;
    add_header Access-Control-Allow-Origin *;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question