I'm having trouble setting up when using nginx as a proxy.
What should I do if I want the current 1 configuration to be like 2?
Include configuration file from nginx.conf
upstream proxy_server{
server 54.248.71.136:3009;
}
server{
listen80;
location / {
proxy_pass http://proxy_server;
proxy_set_header x_custom_header_hoge "hogehoge";
}
}
2. I want to do this
Client - > nginx - > Internet
In this case, how do I change the nginx setting?
nginx is a proxy for adding headers and will be explicitly specified on the client.
I would like to simply add a header and request it to the original request destination.
I feel like I have to specify a proxy destination in proxy_pass, so I wonder what I should do.
(I don't plan to use it as a reverse proxy)
Thank you for your cooperation.
nginx
resolver 8.8.8.8;
server{
listen80;
location / {
proxy_pass$scheme://$http_host$request_uri;
proxy_set_header x_custom_header_hoge "hogehoge";
}
}
For resolver8.8.8
, set the DNS server IP according to your environment.
© 2024 OneMinuteCode. All rights reserved.