Website with login button, redirect to intranet?

Hi everyone,

I would like to check whether this is possible with nginx (on ubuntu
LTS 64 bits).

I have a website

this is just another website.

There is a login button. When someone click on this login button, it
redirect them to However, there are 2
scenarios will happen:-

  • if you are connected to our secure VPN (via OpenVPN), this redirection
    would be successful.
  • if you are not connected to the secure VPN (means the user doesn’t
    any access), then it will show “you are not authorised to view this
    This message should appear within

FYI - hosted on a public facing VPS (outside office) - hosted at my office server (once connected to the
secure VPN, it is as if accessing via intranet)

Is this possible and any suggestions to make this work?


Posted at Nginx Forum:,250715,250715#msg-250715


Assuming your VPN subnet is, In your server{} block on you will want to put the following.

deny all;

error_page 403 = @403;
location @403 {
echo “You are not authorized to view this page”

Thanks :slight_smile: I will give this a try :slight_smile:

Posted at Nginx Forum:,250715,250722#msg-250722

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs