Am 12.09.2019 um 08:08 schrieb 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
What does your backend returns? > Below is my nginx conf file. > > worker_processes 1; > worker_rlimit_nofile 30000; > events { > worker_connections 1024; > } > > > http { > include mime.types; > default_type application/octet-stream; > sendfile on; > keepalive_timeout 65; > server { > listen 80; > return 301 http://mailsvr.parco.net.pk$request_uri; > #rewrite ^/mailsvr/(.*) /$1 break; What's the debug output when you activate the line above and comment the `return 301 ...` in quote from the doc https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return ``` Stops processing and returns the specified code to a client. ``` The rewrite looks good to me. For debug log please take a look into this doc. https://nginx.org/en/docs/debugging_log.html > #rewrite ^/http://mailsvr.parco.net.pk(.*)$ > http://mailsvr.parco.net.pk/mail=$1 permanent; > #return 301 http://$host$request_uri; > #server_name 192.168.17.53; > client_max_body_size 100m; > > location /{ > #proxy_pass http://172.17.5.157/; > #proxy_set_header X-Real-IP $remote_addr; > #proxy_set_header X-Forwarded-For $remote_addr; > #proxy_set_header Host $host; > #proxy_set_header X-Forwarded-Proto $scheme; > proxy_read_timeout 240; > proxy_buffering off; > }#end location > }#end server > > }#end http > > -- > Zeeshan Qaiser Opel > +92-301-8446630 > > _______________________________________________ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx > _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx