pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: nginx redirect and anubisn



Greg Troxel <gdt%lexort.com@localhost> writes:

> But then nginx returns a 301 to
>
>   http://foo.example.com:backendport/bar/
>
> This is wrong because the server's external address is
>
>   https://foo.example.com/bar/

Note:
  - lack of https
  - spurious port


I have worked around this with the following in my server block:

        # If the url is /foo and foo is a directory, then nginx will
        # return a redirect to foo/.  However, it will use the scheme
        # and port for this server, rather than the scheme and port
        # that the external world uses.
        #
        # Rewrite URLs that contain only letters, numbers, dashes and
        # slashes (because I don't use other URLs) but **do not end in
        # a /** to add a trailing slash.
        #
        # This craftily excludes rewriting for index.html
        rewrite ^/([a-z0-9/-]*[^/])$ https://foo.example.com/$1/ redirect;

I still think there should be a way to tell nginx "the external name for
this server is" but I don't know if that's
  - nginx should implement it
  - it's implemented and I haven't found it


I expect everyone with anubis to have trouble.


Home | Main Index | Thread Index | Old Index