NCHlab / RTPEA

Retroelement Protein Expression Atlas
http://www.rtpea.com
1 stars 0 forks source link

adblock interferring with react table #33

Closed Nazrath10R closed 6 years ago

Nazrath10R commented 6 years ago

We using our API to retrieve our data and react to render it in a table.

However, adblocker seems to stop it and wanted to ask if you could provide some advice @IsmailM

For now we are displaying a message to tell people to pause their adblocker

here's the link - https://rtpea.com/browse

IsmailM commented 6 years ago

Hey guys,

Why do you have another domain name for the API?

Adblocking extensions have the ability to block cross-domain requests - no real way to get around it.

Simply use a subdomain - e.g. https://api.rtpea.com or similar...

This will be quite simple to setup - i.e. you only need to change a single line in the virtual host config in Nginx... Give me a shout if you need help with this (this would be a 2 min thing to test if this fixes it)...

If you can't do this for whatever reason - you can set up a server-side redirection (or even on the DNS level) to bypass this... (but fixing the Nginx would be the preferred solution.

PS. RTPEA is a really catchy name - who came up with it ;)? PPS. That Red used for the error message is really ugly - use bootstrap's builtin colours for the alert-danger OR use a softer red - never use actual version of the colour. PPPS. Don't use programming terms (such as regex) in the front end. PPPPS. Use Margins more on your divs (and on the logo) PPPPPS. Maybe use Flexbox (or other fancy CSS) to push down the footer to the bottom of the screen.

But yes - the website is coming together quite nicely 👍

(sorry couldn't help but give my general comments)

NCHlab commented 6 years ago

We didn't know how to do it without having another domain name, so any help would be appreciated and we could pass this onto Adrian, who helped us set it up.

Appreciate the general comments, even the small things help make the site function / appear better.

IsmailM commented 6 years ago

On the server, in the following file: /etc/nginx/sites-available/rtpea-api.conf change the server_name from nayamc.com to api.rtpea.com.

Also, we might need to remove the Certbot lines from this file (i.e. last server{} block in the file) and then rerun Certbot

NCHlab commented 6 years ago

that conf file looks like this:

upstream backend_rtpea-api {
    server 127.0.0.1:3001;
}
server {
    server_name api.rtpea.com;

    # Tells Nginx to serve static assets from this directory.
    root /home/rtpea/RTPEA/;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass       http://backend_rtpea-api;
    }

    listen 80;
}

Then you need to run certbot --nginx (command might differ depending on how certbot was installed) and then restart the nginx service...

IsmailM commented 6 years ago

Yep - I have access to the server 👍

See my previous comment...

I've edited your comment - to comment out the necessary lines

Do you have sudo on the server? I can walk you through what to do....

IsmailM commented 6 years ago

I've edited your comment

NCHlab commented 6 years ago

I don't have sudo access to the server.

Naz is supposed to get it before adrian leaves.

IsmailM commented 6 years ago

cool 👍

@Nazrath10R - sort me out with sudo access as well ;)

Nazrath10R commented 6 years ago

thanks for the advice and comments Ismail. Still waiting on Adrian (think he is off till the end of the week)

NCHlab commented 6 years ago

domain moved api.rtpea.com > seems to have fixed adblock issue.

@IsmailM

Thanks

Nazrath10R commented 6 years ago

well done! Don't forget to remove the adblock message