Rewriting url in nginx

2019-09-11 Thread Zeeshan Opel
I am trying to rewrite a url in nginx. When i am accessing mail.parco.net.pk in browser, it opens below link: http://mailsvr.parco.net.pk/mailsvr/mail/mailbox.nsf But in actual it should open http://mailsvr.parco.net.pk/mail/mailbox.nsf Below is my nginx conf file. worker_processes 1; worker_

Re: Proxy Pass based on the first field in the URI

2019-09-11 Thread Francis Daly
On Wed, Sep 11, 2019 at 08:41:15PM +0200, meir hazon wrote: Hi there, > I don't think so, it should always be the first field of the URI but it > would be a random string. I have to proxy pass and rebuild the new URI > based on location at the original URI only. I don't understand what your requ

Re: Proxy Pass based on the first field in the URI

2019-09-11 Thread meir hazon
Hi, It looks great, I will try it out and let you know. Thanks so much, Meir On Wed, Sep 11, 2019 at 5:56 PM j94305 wrote: > Try something like this: > > map $urlprefix $urlproxy { > "foo" "https://foohost.foo.com";; > "bar" "http://barhost.blah.com";; > "fie" "https://fie.special.domai

Re: Proxy Pass based on the first field in the URI

2019-09-11 Thread meir hazon
Hi, I don't think so, it should always be the first field of the URI but it would be a random string. I have to proxy pass and rebuild the new URI based on location at the original URI only. Could you think of a way to do this? Thanks so much, Meir On Wed, Sep 11, 2019 at 5:46 PM Francis Daly

Re: Proxy Pass based on the first field in the URI

2019-09-11 Thread j94305
Try something like this: map $urlprefix $urlproxy { "foo" "https://foohost.foo.com";; "bar" "http://barhost.blah.com";; "fie" "https://fie.special.domain.com/blubb";; default "https://standard.com";; } [...] location ~ "^/(?[^/]+)(?/.*)$" { [...] proxy_pass "$urlproxy$urlsuffix$is_

Re: Proxy Pass based on the first field in the URI

2019-09-11 Thread Francis Daly
On Wed, Sep 11, 2019 at 04:45:21PM +0200, meir hazon wrote: Hi there, > I would also like to pass the message to the proxy without the first part > of the URI but use the rest of it. http://nginx.org/r/proxy_pass includes the section: """ If the proxy_pass directive is specified with a URI, th

Proxy Pass based on the first field in the URI

2019-09-11 Thread meir hazon
Hello, I have tried to do the following but couldn't pull it out. Maybe you will have a good idea as I am not an expert. I would like to proxy pass to different proxies based on the first part of a URI. I would also like to pass the message to the proxy without the first part of the URI but use