Redirect Rule
Maxim Dounin
mdounin at mdounin.ru
Sat Jul 9 21:08:14 MSD 2011
Hello!
On Sat, Jul 09, 2011 at 09:41:42PM +0530, milin korath wrote:
> Hi
> >
> >
> > location = /x/y {
> > # ... process it right here
> > }
> > What should i need to write here.Sorry i am not familiar with nginx
> > directives ..
If you want it to be served as static - just leave this block
empty. If you want to handle it with backend - write appropriate
proxy_pass/fastcgi_pass/... as in your https server.
Maxim Dounin
> > Thanks
> >
> >
> >
> > On Sat, Jul 9, 2011 at 6:53 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> >
> >> Hello!
> >>
> >> On Sat, Jul 09, 2011 at 06:19:04PM +0530, milin korath wrote:
> >>
> >> > Hello
> >> >
> >> > I am running my djago application in nginx server. In my configuration I
> >> > redirect all http to https using the below settings
> >> >
> >> > location / { rewrite ^/(.*) https://mydomain.com/$1 permanent; }
> >> >
> >> > What i want is i need to redirect to all my http request to https
> >> except
> >> > only one url like http://mydomain.com/x/y.
> >> >
> >> > I tried
> >> >
> >> > location ~* / {
> >>
> >> There is no need to use regexp here, just normal "location /" will
> >> do the same thing.
> >>
> >> > rewrite ^/(.*) https://mydomain.com/$1 permanent;
> >>
> >> Something like
> >>
> >> rewrite ^ https://mydomain.com$request_uri? permanent;
> >>
> >> is a bit more effecient way to do the same thing.
> >>
> >> > }
> >> >
> >> > location = mydomain.com/x/y {
> >>
> >> You don't need "mydomain.com" here, just "location = /x/y".
> >>
> >> > rewrite ^/(.*) http://mydomain.com/$1 permanent;
> >>
> >> And you don't need redirect here, as it will create infinite loop
> >> as long as this is config for http part of mydomain.com.
> >>
> >> > }
> >> >
> >> > But no luck.Can you please advice me what went wrong here.Really i am
> >> struck
> >> > with this.
> >>
> >> Bringing all of the above together gives something like this:
> >>
> >> location / {
> >> rewrite ^ https://mydomain.com$request_uri? permanent;
> >> }
> >>
> >> location = /x/y {
> >> # ... process it right here
> >> }
> >>
> >> Maxim Dounin
> >>
> >> _______________________________________________
> >> nginx mailing list
> >> nginx at nginx.org
> >> http://nginx.org/mailman/listinfo/nginx
> >>
> >
> >
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list