TeamPiped / Piped

An alternative privacy-friendly YouTube frontend which is efficient by design.
https://piped.video
GNU Affero General Public License v3.0
8.2k stars 669 forks source link

404. Not Found io.activej.http.HttpError: HTTP code 404: Not found #847

Closed Deon-Trevor closed 2 years ago

Deon-Trevor commented 2 years ago

Hello all. I'm hoping to host my own instance of Piped but no matter which method i use i'm getting stuck at the same place. After following all the steps when i finally launch it i get a

404. Not Found
io.activej.http.HttpError: HTTP code 404: Not found

ActiveJ 5.1

I am currently using Docker-Compose with Nginx but i got the same problem with both the Docker-Compose Caddy AIO script and the Docker-Compose Nginx AIO script

My api is at api.piped.mysite.com and the proxy is at proxy.piped.mysite.com. Everything else is as instructed on ipns://piped-docs.kavin.rocks/docs/self-hosting/

Not sure where i'm missing it. Please help. And let me know if you need any more info to help troubleshoot but everything is set up pretty much mile how the guide says.

mmjee commented 2 years ago

Are you actually opening the frontend URL? That's usually what you get when you make a request to the backend instead of the frontend. The backend I suppose is working fine.

On 22/02/22 00:08, Sync_Pundit wrote:

Hello all. I'm hoping to host my own instance of Piped but no matter which method i use i'm getting stuck at the same place. After following all the steps when i finally launch it i get a

404. Not Found
io.activej.http.HttpError: HTTP code 404: Not found

ActiveJ 5.1

I am currently using Docker-Compose with Nginx but i got the same problem with both the Docker-Compose Caddy AIO script and the Docker-Compose Nginx AIO script

My api is at api.piped.mysite.com and the proxy is at proxy.piped.mysite.com. Everything else is as instructed on ipns://piped-docs.kavin.rocks/docs/self-hosting/

Not sure where i'm missing it. Please help. And let me know if you need any more info to help troubleshoot but everything is set up pretty much mile how the guide says.

Deon-Trevor commented 2 years ago

I am opening the front-end. The backend does not show anything besides an error when opened.

api.piped.mysite.com uses an unsupported protocol.
ERR_SSL_VERSION_OR_CIPHER_MISMATCH

tried with the frontend's ssl certs and also using unique certs for the api and the proxy but the result is the same. The behaviour above is for the frontend

FireMasterK commented 2 years ago

What reverse proxy are you using? Nginx? From what I can tell, the reverse proxy in front of Piped is causing issues.

Deon-Trevor commented 2 years ago

I am using Nginx. What am i not doing right with my nginx conf?

server {
    #listen 443 ssl http2;
    ssl_early_data on;
    server_name api.piped.mysite.com;

    location / {
       proxy_pass http://127.0.0.1:8080;
    }

    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/piped.mysite.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/piped.mysite.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
    #listen 443 ssl http2;
    ssl_early_data on;
    server_name proxy.piped.mysite.com;

    location ~ (/videoplayback|/api/v4/|/api/manifest/) {
       include snippets/ytproxy.conf;
       add_header Cache-Control private always;
       proxy_hide_header Access-Control-Allow-Origin;
    }

    location / {
       include snippets/ytproxy.conf;
       add_header Cache-Control "public, max-age=604800";
       proxy_hide_header Access-Control-Allow-Origin;
    }

    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/piped.mysite.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/piped.mysite.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = api.piped.mysite.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name api.piped.mysite.com;
    return 404; # managed by Certbot

}

server {
    if ($host = proxy.piped.mysite.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name proxy.piped.mysite.com;
    return 404; # managed by Certbot

}
FireMasterK commented 2 years ago

https://piped-docs.kavin.rocks/docs/self-hosting/#docker-compose-nginx-aio-script is the guide expected to be followed for such an instance

You just would need to change the the Nginx config like so:

server {
    listen 80;
    server_name piped.mysite.com;

    location / {
       proxy_pass http://127.0.0.1:8080;
       proxy_set_header Host $host;
    }
}

server {
    listen 80;
    server_name proxy.piped.mysite.com;

    location / {
       proxy_pass http://127.0.0.1:8080;
       proxy_set_header Host $host;
    }
}

server {
    listen 80;
    server_name api.piped.mysite.com;

    location / {
       proxy_pass http://127.0.0.1:8080;
       proxy_set_header Host $host;
    }
}

and finally, get certbot to include SSL certificates.

Deon-Trevor commented 2 years ago

I've made some progress, thanks. I'm still stuck but we have some progress nonetheless. Now both the api and proxy are showing the:

404. Not Found
io.activej.http.HttpError: HTTP code 404: Not found

ActiveJ 5.1

As you had mentioned. Although the frontend is also, still, showing the same.

FireMasterK commented 2 years ago

Now both the api and proxy are showing the

This is the api/backend, which means you're likely not sending a proper host header to the nginx instance.

Can you run ./configure-instance.sh and provide hostnames, without the third period? Like piped.mysite.com, pipedapi.mysite.com, and pipedproxy.mysite.com.

Deon-Trevor commented 2 years ago

Fixed the problem right up! Many thanks to everyone for helping. Cheers!!!!

jollySleeper commented 5 months ago

Now both the api and proxy are showing the

This is the api/backend, which means you're likely not sending a proper host header to the nginx instance.

So, @FireMasterK (sorry for the tag :cry: ) you are saying that without reverse-proxy it will always break?