user3524699
user3524699

Reputation: 27

How to make project documentation only to the end users?

I need to place a link/icon in one of the angular component. when i click on the link it should open the documentation html index page however i am not able restrict the documentation only to the end users. I am using nginx to deploy my angular app and also to serve the project documentation.

so here is a part from my angulare component code.

<a href='{{documentationLink}}'>documentation</a>

following is my nginx configuration . the ui code is placed in the folder /usr/share/nginx/html and the html documentation is placed in the folder /usr/share/nginx/html/mep-docs.

 server {
        server_name primecast-vagrant;
        access_log /var/log/nginx/primecast-nginx.log main;
        index  index.html;
        location /MEP {
        root /usr/share/nginx/html/mep-docs;
        index  index_MEP.htm;
       }
   }

so my question is how can i restrict access to the documentation only to the users who logged into the application?

Upvotes: 0

Views: 88

Answers (1)

Fonzy
Fonzy

Reputation: 691

It pretty much depends what you are trying to accomplish...

If you restrict the path in angular-router via guard, the data could still be extracted from the loaded .js files. You could negate this effect by using code splitting and lazy-load the required .js files.

You could also restrict the access to the /usr/share/nginx/html/mep-docs path via nginx ala:

location /MEP {
  auth_basic "Authentication required";
  auth_basic_user_file </path/to/htpasswd>;

  root /usr/share/nginx/html/mep-docs;
  index  index_MEP.htm;
}

which would result in an auth-check for all subpaths of /MEP. You can read a guide about it here.

Personally I would split the two applications and restrict the documentation via nginx.

Hope it helps, G

Upvotes: 0

Related Questions