comparison xml/en/docs/http/ngx_http_proxy_module.xml @ 351:a4fa80755eab

Consistently strip initial offset in examples.
author Ruslan Ermilov <ru@nginx.com>
date Tue, 24 Jan 2012 11:01:22 +0000
parents 1fb1c077658b
children db6774c4c699
comparison
equal deleted inserted replaced
350:55c1c4a1748f 351:a4fa80755eab
536 <para> 536 <para>
537 Sets an address of the proxied server and a URI that maps a location. 537 Sets an address of the proxied server and a URI that maps a location.
538 An address can be specified as a domain name or an address, and a port, 538 An address can be specified as a domain name or an address, and a port,
539 for example, 539 for example,
540 <example> 540 <example>
541 proxy_pass http://localhost:8000/uri/; 541 proxy_pass http://localhost:8000/uri/;
542 </example> 542 </example>
543 or as a UNIX-domain socket path: 543 or as a UNIX-domain socket path:
544 <example> 544 <example>
545 proxy_pass http://unix:/tmp/backend.socket:/uri/; 545 proxy_pass http://unix:/tmp/backend.socket:/uri/;
546 </example> 546 </example>
547 here a path is specified after the word “<literal>unix</literal>” 547 here a path is specified after the word “<literal>unix</literal>”
548 and enclosed in two colons. 548 and enclosed in two colons.
549 </para> 549 </para>
550 550
615 </para> 615 </para>
616 616
617 <para> 617 <para>
618 Server name, its port, and passed URI can be specified using variables: 618 Server name, its port, and passed URI can be specified using variables:
619 <example> 619 <example>
620 proxy_pass http://$host$uri; 620 proxy_pass http://$host$uri;
621 </example> 621 </example>
622 or like this: 622 or like this:
623 <example> 623 <example>
624 proxy_pass $request; 624 proxy_pass $request;
625 </example> 625 </example>
626 </para> 626 </para>
627 627
628 <para> 628 <para>
629 In this case the server name is searched among the described 629 In this case the server name is searched among the described
683 from the proxied server. 683 from the proxied server.
684 Suppose a proxied server returned the header field 684 Suppose a proxied server returned the header field
685 “<literal>Location: http://localhost:8000/two/some/uri/</literal>”. 685 “<literal>Location: http://localhost:8000/two/some/uri/</literal>”.
686 The directive 686 The directive
687 <example> 687 <example>
688 proxy_redirect http://localhost:8000/two/ http://frontend/one/; 688 proxy_redirect http://localhost:8000/two/ http://frontend/one/;
689 </example> 689 </example>
690 will rewrite this string to 690 will rewrite this string to
691 “<literal>Location: http://frontend/one/some/uri/</literal>”. 691 “<literal>Location: http://frontend/one/some/uri/</literal>”.
692 </para> 692 </para>
693 693
694 <para> 694 <para>
695 A server name may be omitted from the <value>replacement</value> string: 695 A server name may be omitted from the <value>replacement</value> string:
696 <example> 696 <example>
697 proxy_redirect http://localhost:8000/two/ /; 697 proxy_redirect http://localhost:8000/two/ /;
698 </example> 698 </example>
699 then the primary server’s name and a port, if different from 80, 699 then the primary server’s name and a port, if different from 80,
700 will be substituted. 700 will be substituted.
701 </para> 701 </para>
702 702
722 </para> 722 </para>
723 723
724 <para> 724 <para>
725 A <value>replacement</value> string can contain variables: 725 A <value>replacement</value> string can contain variables:
726 <example> 726 <example>
727 proxy_redirect http://localhost:8000/ http://$host:$server_port/; 727 proxy_redirect http://localhost:8000/ http://$host:$server_port/;
728 </example> 728 </example>
729 </para> 729 </para>
730 730
731 <para> 731 <para>
732 A <value>redirect</value> can also contain (1.1.11) variables: 732 A <value>redirect</value> can also contain (1.1.11) variables:
733 <example> 733 <example>
734 proxy_redirect http://$proxy_host:8000/ /; 734 proxy_redirect http://$proxy_host:8000/ /;
735 </example> 735 </example>
736 </para> 736 </para>
737 737
738 <para> 738 <para>
739 A directive can be specified (1.1.11) using regular expressions. 739 A directive can be specified (1.1.11) using regular expressions.
742 or from the “<literal>~*</literal>” symbols for case-insensitive 742 or from the “<literal>~*</literal>” symbols for case-insensitive
743 matching. 743 matching.
744 A regular expression can contain named and positional captures, 744 A regular expression can contain named and positional captures,
745 and <value>replacement</value> can reference them: 745 and <value>replacement</value> can reference them:
746 <example> 746 <example>
747 proxy_redirect ~^(http://[^:]+):\d+(/.+)$ $1$2; 747 proxy_redirect ~^(http://[^:]+):\d+(/.+)$ $1$2;
748 proxy_redirect ~*/user/([^/]+)/(.+)$ http://$1.example.com/$2; 748 proxy_redirect ~*/user/([^/]+)/(.+)$ http://$1.example.com/$2;
749 </example> 749 </example>
750 </para> 750 </para>
751 751
752 <para> 752 <para>
753 There could be several <literal>proxy_redirect</literal> directives: 753 There could be several <literal>proxy_redirect</literal> directives:
754 <example> 754 <example>
755 proxy_redirect default; 755 proxy_redirect default;
756 proxy_redirect http://localhost:8000/ /; 756 proxy_redirect http://localhost:8000/ /;
757 proxy_redirect http://www.example.com/ /; 757 proxy_redirect http://www.example.com/ /;
758 </example> 758 </example>
759 </para> 759 </para>
760 760
761 <para> 761 <para>
762 The <literal>off</literal> parameter cancels all 762 The <literal>off</literal> parameter cancels all
763 <literal>proxy_redirect</literal> directives on the current level: 763 <literal>proxy_redirect</literal> directives on the current level:
764 <example> 764 <example>
765 proxy_redirect off; 765 proxy_redirect off;
766 proxy_redirect default; 766 proxy_redirect default;
767 proxy_redirect http://localhost:8000/ /; 767 proxy_redirect http://localhost:8000/ /;
768 proxy_redirect http://www.example.com/ /; 768 proxy_redirect http://www.example.com/ /;
769 </example> 769 </example>
770 </para> 770 </para>
771 771
772 <para> 772 <para>
773 Using this directive it is also possible to add host names to relative 773 Using this directive it is also possible to add host names to relative
774 redirects issued by a proxied server: 774 redirects issued by a proxied server:
775 <example> 775 <example>
776 proxy_redirect / /; 776 proxy_redirect / /;
777 </example> 777 </example>
778 </para> 778 </para>
779 779
780 </directive> 780 </directive>
781 781