Welcome! Log In Create A New Profile

Advanced

Re: Allow internal redirect to URI x, but deny external request for x?

All files from this thread

File Name File Size   Posted by Date  
smime.p7s 3.5 KB open | download j94305 09/03/2019 Read message
smime.p7s 3.5 KB open | download j94305 09/04/2019 Read message
J. Lewis Muir
August 31, 2019 11:32AM
On 08/30, Ian Hobson wrote:
> Hi Lewis,
>
> On 30/08/19 18:33, J. Lewis Muir wrote:
> > Hello!
> >
> > I'm using nginx 1.12.2 on RHEL 7, and I've got a FastCGI web app that
> > uses a deployment structure which uses an atomic symlink change for an
> > atomic app deploy, and I'm wishing to be able to do an internal redirect
> > in nginx to URL x, but deny an external request to the same URL x so
> > that I don't serve the same content at more than one URL. Is there a
> > way to do that?
> >
> You could place the different versions away from the root so they cannot be
> obtained from the web. Then they can be served by setting up a symlink to
> the desired version.
>
> This can be changed using "ln -sfn version/dir serving/root" and then
> restarting nginx to pick up the new version.
>
> By not using redirects, this method should be more efficient.
>
> Regards
>
> Ian

Hi, Ian!

Thank you for the suggestion! That's an interesting idea, and that
would avoid needing to exclude those URIs from being served and I think
avoid needing to change the document root and maybe some other things.

I toyed around with some designs and came up with four; I think I like
the third one best, but I'm not sure, maybe the fourth one is better.

= Design #1

Web app root:

/srv/www/app/my-app
current -> releases/1.0.2
releases
1.0.0
1.0.1
1.0.2

nginx server document root:

/srv/www/host/localhost
my-app -> /srv/www/app/my-app/current

Comments:

This tries to share apps between virtual hosts. It provides no way
for different virtual hosts to serve the same app but with the app
configured differently. Also, all virtual hosts have to serve the
same version of the app.

= Design #2

Web app root:

/srv/www/app/my-app
1.0.0
1.0.1
1.0.2

nginx server document root:

/srv/www/host/localhost
my-app -> /srv/www/app/my-app/1.0.2

Comments:

Similar to design #1 except now the virtual hosts can server different
versions of the app, but for a given version, the app is still
configured in the exact same way for all virtual hosts.

= Design #3

Web app root:

/srv/www/localhost/app
my-app
1.0.0
1.0.1
1.0.2

nginx server document root:

/srv/www/localhost/root
my-app -> ../app/my-app/1.0.2

Comments:

I like this because now each virtual host has its own set of deployed
apps, so the apps can be configured specifically for that particular
virtual host.

= Design #4

Web app root:

/srv/www/localhost/app
my-app
current -> releases/1.0.2
releases
1.0.0
1.0.1
1.0.2

nginx server document root:

/srv/www/localhost/root
my-app -> ../app/my-app/current

Comments:

Similar to design #3 but moves where the "current" symlink lives. So,
the deployed version of the app is controlled under the web app root
rather under the nginx server document root. Maybe this is a little
better because the nginx config reference to "my-app" can be sure to
be correct and can be changed if desired, and be unrelated to which
version of the app is deployed via the "current" symlink in the web
app root. The downside is two symlinks (i.e., a symlink to a symlink)
as opposed to one.

Regards,

Lewis
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 30, 2019 01:34PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 30, 2019 02:22PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 30, 2019 02:38PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 30, 2019 03:00PM

Re: Allow internal redirect to URI x, but deny external request for x?

Francis Daly August 30, 2019 04:56PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 30, 2019 06:00PM

Re: Allow internal redirect to URI x, but deny external request for x?

Francis Daly August 30, 2019 07:22PM

Re: Allow internal redirect to URI x, but deny external request for x?

Francis Daly August 31, 2019 03:28AM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 31, 2019 11:06AM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 31, 2019 10:12AM

Re: Allow internal redirect to URI x, but deny external request for x?

Francis Daly August 31, 2019 04:52PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 31, 2019 05:56PM

Re: Allow internal redirect to URI x, but deny external request for x?

Francis Daly September 02, 2019 05:04PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir September 03, 2019 01:28PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir September 03, 2019 05:32PM

Re: Allow internal redirect to URI x, but deny external request for x?

Ian Hobson August 30, 2019 03:02PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir August 31, 2019 11:32AM

Re: Allow internal redirect to URI x, but deny external request for x?

Francis Daly August 30, 2019 04:34PM

Re: Allow internal redirect to URI x, but deny external request for x?

gariac August 30, 2019 05:24PM

Re: Allow internal redirect to URI x, but deny external request for x?

Ian Hobson August 31, 2019 10:42AM

Re: Allow internal redirect to URI x, but deny external request for x?

j94305 August 30, 2019 06:28PM

Re: Allow internal redirect to URI x, but deny external request for x?

gariac August 31, 2019 03:20PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir September 03, 2019 11:30PM

Re: Allow internal redirect to URI x, but deny external request for x? Attachments

j94305 September 03, 2019 11:56PM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir September 04, 2019 11:30AM

Re: Allow internal redirect to URI x, but deny external request for x? Attachments

j94305 September 04, 2019 11:44AM

Re: Allow internal redirect to URI x, but deny external request for x?

J. Lewis Muir September 04, 2019 12:32PM

Re: Allow internal redirect to URI x, but deny external request for x?

j94305 September 10, 2019 02:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 327
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready