Nginx proxy_pass not working as expected.

Jeff Dyke jeff.dyke at gmail.com
Fri Oct 28 14:02:19 UTC 2016


You may want to define example.org as an upstream if it is just an
application server that handles requests, but not entirely sure what you're
trying to accomplish...

upstream anything.you.want {
server 127.0.0.1:PORT # or domain name;
}

server {
server_name example.com;

location / {
proxy_pass http://a <http://example.org/>nything.you.want;
}
}

HTH
Jeff

On Fri, Oct 28, 2016 at 9:12 AM, stuwat <nginx-forum at forum.nginx.org> wrote:

> Hi
>
> I have the virtualhost file configured as the following:-
>
> server {
> server_name example.com;
>
> location / {
> proxy_pass http://example.org;
> }
> }
>
>
> When I visit example.com it redirects correctly to example.org, but I need
> it to show example.com in the address bar.  How can I do this?
>
> i tried changing it to
>
> location / {
> proxy_pass http://example.org;
> proxy_set_header Host           example.com;
> }
> }
>
> but it still shows example.org in the address bar, what do I need to do?
>
> Thanks
>
> Posted at Nginx Forum: https://forum.nginx.org/read.
> php?2,270626,270626#msg-270626
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20161028/dee0d075/attachment.html>


More information about the nginx mailing list