Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yourls error 400, trying to create multiple shortlinks? #1099

Open
pellle87 opened this issue Jun 11, 2023 · 4 comments
Open

Yourls error 400, trying to create multiple shortlinks? #1099

pellle87 opened this issue Jun 11, 2023 · 4 comments

Comments

@pellle87
Copy link

Steps to reproduce

  1. create a paste
  2. klick the shorten button

What happens

it creates a shorturl but it seems to try to create multiple
{"status":"fail","code":"error:url","message":"https:\/\/p.xxxxx.se\/?a7d0d61ffeabdfce#H7JSiqfPqe7v6EdDFbz[...] already exists in database (short URL: sh.xxxx.se\/6c3wl)","errorCode":"400","statusCode":"400","url":{"keyword":"6c3wl","url":"https:\/\/p.xxxxx.se\/?a7d0d61ffeabdfce#H7JSiqfPqe7v6EdDFbzaG4o6QQYn1PB4Dc9bDkZ9nhLy","title":"https:\/\/p.xxxxx.se\/?a7d0d61ffeabdfce#H7JSiqfPqe7v6EdDFbzaG4o6QQYn1PB4Dc9bDkZ9nhLy","date":"2023-06-11 19:33:14","ip":"2xxxx.1xx.xx.xx","clicks":0},"title":"https:\/\/p.xxxxx.se\/?a7d0d61ffeabdfce#H7JSiqfPqe7v6EdDFbzaG4o6QQYn1PB4Dc9bDkZ9nhLy","shorturl":"https:\/\/sh.xxxx.se\/6c3wl"}

Additional information

urlshortener = "https://sh.xxxxxxx.se/yourls-api.php?signature=xxxxxxxxx&action=shorturl&format=json&url="

Basic information

Server OS:
ubuntu:22.04
php 8.1

Webserver: Apache (latest)

Browser: Brave

PrivateBin version:
1.5.1
I can reproduce this issue on https://privatebin.net: Yes / No

@pellle87
Copy link
Author

if i use
urlshortener = "${basepath}shortenviayourls?link="
and
signature = "xxxxxxxxx"
apiurl = "https://sh.mydomain/api.php"

i get redirected to https://mydomain.se/shortenviayourls?link= and i get a 404

@elrido
Copy link
Contributor

elrido commented Jun 14, 2023

[...]"message":"https:\/\/p.xxxxx.se\/?a7d0d61ffeabdfce#H7JSiqfPqe7v6EdDFbz[...]

and

if i use
urlshortener = "${basepath}shortenviayourls?link="
[...]
i get redirected to https://mydomain.se/shortenviayourls?link= and i get a 404

That sounds like the basepath is not set and not detected correctly or it is and your webserver is not forwarding the /shortenviayourls path to the index.php of PrivateBin. This is difficult to diagnose remotely and likely a misconfiguration of the two services and/or used webservers, not a bug in the software.

@pellle87
Copy link
Author

pellle87 commented Jun 14, 2023

[...]"message":"https:\/\/p.xxxxx.se\/?a7d0d61ffeabdfce#H7JSiqfPqe7v6EdDFbz[...]

and

if i use
urlshortener = "${basepath}shortenviayourls?link="
[...]
i get redirected to https://mydomain.se/shortenviayourls?link= and i get a 404

That sounds like the basepath is not set and not detected correctly or it is and your webserver is not forwarding the /shortenviayourls path to the index.php of PrivateBin. This is difficult to diagnose remotely and likely a misconfiguration of the two services and/or used webservers, not a bug in the software.

basepath is set to: basepath = "https://p.mydomain.se/"

and my apache virtualhost looks like this:

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName p.mydomain.se
        ServerAlias www.p.mydomain.se
        ServerAdmin pelle@mydomain.me
        DocumentRoot /var/www/p.mydomain.se/public_html/
        ErrorLog /${APACHE_LOG_DIR}/p.mydomain.se-error.log
        CustomLog ${APACHE_LOG_DIR}/p.kmydomain.se-access.log combined
<Directory "/var/www/p.mydomain.se/public_html/">
        Options Includes FollowSymLinks MultiViews
        AllowOverride All
         Order allow,deny
      Allow from all
   </Directory>

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/p.mydomain.se/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/p.mydomain.se/privkey.pem
</VirtualHost>
</IfModule>

Yea it might be a misconfig by one of the two services, but i cant for the life of me figure it out since everything else works etc

@pellle87
Copy link
Author

if i configure it like this:
urlshortener = "https://sh.mydomain.se/api.php?action=shorturl&format=json&url="
and comment out signature and api url i get redirected to my yourls page but it says

Too Many Requests
Too many URLs added too fast. Slow down please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants