400 bad request in shlink links from public network

Currently reading
400 bad request in shlink links from public network

104
7
NAS
DS918+
Operating system
  1. Windows
Mobile operating system
  1. Android
Despite resolving the issues I had by accessing via shlink namely, connection refused on most browsers, as described here. But this time, there is a 400 bad request in every browser call from public network only. Shlink calls from private network are not affected.

Some searching leads me to a section in shlink documentation but refers a 404 error. There is no references for exact 400 errors. So this is the closest help I got: Shlink - The URL shortener — Documentation.

But maybe my thoughts are wrong. Maybe the issue is related with this situation where 400 bad request is mentioned: Shlink - The URL shortener — Documentation

I did read somewhere else that shlink must be configured additionally to handle non-common domains as is in the case by reverse proxy with .cc domain. Don't know if this make sense.

Again, I gathered some info here and there, but don't have tech knowledge enough put a solution in practice.
Please, I need help to get rid of this issue in particular to I finally put shlink to serve to something real.

Thank you.
 
Solution
bjsa.cc points to the same IP address as bjamsa.myds.me now. However, using bjsa.cc gives a warning that its not safe but if accept it, I can reach your web station. It’s because of the certificate. It’s issued for bjamsa.myds.me
Look it is issued.
1617650095599.png


Which one do you want to use?

View attachment 3358
-- post merged: --

View attachment 3359
-- post merged: --

Sorry. What I meant above is that if I use https://s1.bjsa.cc I can get to your web station after I accept the risk.

View attachment 3360
-- post merged: --

Here’s a suggestion (since I remember you saying that don’t care if it’s http).

Change the Reverse Proxy settings (your screenshot above) under source to:
Protocol http...
s1.bjsa.cc is trusted now. That’s good 🙂

View attachment 3365

However, I don’t think you're done yet. What about updating Godaddy’s DNS when your IP address changes? You'll need to figure out a way to do that, unless you've a static address (or resort to doing it manually).
You're right. We'll see that in the (near) future. I'll stick around.
 
Upvote 0
Upvote 0
See if this works. Although I tend to avoid this site as it doesn't rate high on my quality meter, but this is what came up when searching!
Well, I followed the instruction given in this website, but couldn't see any modification or replacement of the IP. I did insert a different public IP from the real one in godaddy's dns settings, in hope the routine would do the job as proposed (comparing IP and set the real one), but it didn't. No reaction at all, no e-mail received.
Could you see anything in the code below that maybe was mistyped by the author?

Code:
#!/bin/bash
# This script checks and automatically updates your GoDaddy DNS "A" record server with your current IP address.
# by Marius Bogdan Lixandru updated to make it work with Synology NAS for users with Dynamic IP.
domain="mariusdigital.com"   # Your own domain name
name="@"     # name of A record to update
key="9fdfdkWs3TTTfhJ6HGzgfdgKTdsgfiOpCX"     # Your own GoDaddy developer API Key See STEP 4
secret="GgdfiBgdffgK419dfUoKUZgdGGFA"   # Your own GoDaddy developer API Secret Key See STEP 4

headers="Authorization: sso-key $key:$secret"

# echo $headers

result=$(curl -s -X GET -H "$headers" \
 "https://api.godaddy.com/v1/domains/$domain/records/A/$name")

#echo $result;

dnsIp=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
#echo "dnsIp:" $dnsIp

# Get public IP address. There are several websites that can do this.
ret=$(curl -s GET "https://ipinfo.io/json")
currentIp=$(echo $ret | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")


#echo "currentIp:" $currentIp

if [ "$dnsIp" != "$currentIp" ];
 then
#    echo "Ips are not equal"
    request='[{"data":"'$currentIp'","ttl":600}]'
#    echo " request:" $request
    nresult=$(curl -i -s -X PUT \
 -H "$headers" \
 -H "Content-Type: application/json" \
 -d $request "https://api.godaddy.com/v1/domains/$domain/records/A/$name")
#    echo "result:" $nresult
fi
 
Upvote 0
I'd uncomment the echo lines and see what gets printed out.
The result is:

Code:
Dear user,

Task Scheduler has completed a scheduled task.

Task: Godaddy DNS Update
Start time: Thu, 08 Apr 2021 12:30:02 GMT
Stop time: Thu, 08 Apr 2021 12:30:05 GMT
Current status: 0 (Normal)
Standard output/error:
[{"data":"127.0.0.1","name":"@","ttl":3600,"type":"A"}]
dnsIp: 127.0.0.1
currentIp: 93.108.61.205 205.61.108.93
Ips are not equal
 request: [{"data":"93.108.61.205 205.61.108.93","ttl":600}]
result: HTTP/1.1 400 Bad Request
 Content-Type: application/json
 Content-Length: 176
 X-Request-Id: qXpiRGApfYGrNYvEnGkdDd
 X-DataCenter: US_WEST_2
 Expires: Thu, 08 Apr 2021 11:30:05 GMT
 Cache-Control: max-age=0, no-cache, no-store
 Pragma: no-cache
 Date: Thu, 08 Apr 2021 11:30:05 GMT
 Connection: close
 
 {"code":"INVALID_BODY","fields":[{"code":"INVALID_BODY","message":"unexpected EOF","path":"records"}],"message":"Request body doesn't fulfill schema, see details in `fields`"}
 
Upvote 0
Last edited:
[{"data":"127.0.0.1","name":"@","ttl":3600,"type":"A"}]
dnsIp: 127.0.0.1
currentIp: 93.108.61.205 205.61.108.93
Ips are not equal
The returned IP from GoDaddy is the loopback IP (127.0.0.1), a.k.a. localhost, and every device can use this to refer to itself.

The Internet query and parsing results in the same IP address being returned twice: octets forwards and backwards.

So that's two issues to fix:
I don't use GoDaddy so can't suggest a fix for the first problem.​
For the second, I would try replacing the current IP test's URL from https://ipinfo.io/json to http://checkip.dyndns.com. This works for me.​

@butala please check that the "X-Request-Id:" line in your attached output. If that's your key or secret then you may want to remove it.
 
Upvote 0
Well, I followed the instruction given in this website, but couldn't see any modification or replacement of the IP.
Sorry, I don't know. Can't test it without a Godaddy account. Try to search for a similar script on the net. Now that you know what needs to be done with Godaddy, you might be able to substitute it with another script that hopefully works.
 
Upvote 0
Upvote 0
Last edited:
The returned IP from GoDaddy is the loopback IP (127.0.0.1), a.k.a. localhost, and every device can use this to refer to itself.

The Internet query and parsing results in the same IP address being returned twice: octets forwards and backwards.

So that's two issues to fix:
I don't use GoDaddy so can't suggest a fix for the first problem.​
Is this anyhow a problem?. Could you give me a example about the supposed issue?
For the second, I would try replacing the current IP test's URL from https://ipinfo.io/json to http://checkip.dyndns.com. This works for me.​

@butala please check that the "X-Request-Id:" line in your attached output. If that's your key or secret then you may want to remove it.
It worked!
Code:
Dear user,

Task Scheduler has completed a scheduled task.

Task: Godaddy DNS Update
Start time: Thu, 08 Apr 2021 14:50:02 GMT
Stop time: Thu, 08 Apr 2021 14:50:07 GMT
Current status: 0 (Normal)
Standard output/error:
[{"data":"34.102.136.180","name":"@","ttl":3600,"type":"A"}]
dnsIp: 34.102.136.180
currentIp: 93.108.61.205
Ips are not equal
 request: [{"data":"93.108.61.205","ttl":600}]
result: HTTP/1.1 200 OK
 Content-Length: 0
 X-Request-Id: 7iRqBFYSHiXZ28Afd8Wnsp
 X-DataCenter: US_WEST_2
 Expires: Thu, 08 Apr 2021 13:50:07 GMT
 Cache-Control: max-age=0, no-cache, no-store
 Pragma: no-cache
 Date: Thu, 08 Apr 2021 13:50:07 GMT
 Connection: keep-alive

The X-Request-Id has nothing to do with my Godaddy's key, is something different, perhaps internally for the request solicited.

I think it is possible that it doesn't worked at first run due to the Grep command went too far by reading the second line result given from running https://ipinfo.io/json. I just could partially understand the grep command. I do understand very little about linux commands. Make this way of thinking sense?
-- post merged: --

Sorry, I don't know. Can't test it without a Godaddy account. Try to search for a similar script on the net. Now that you know what needs to be done with Godaddy, you might be able to substitute it with another script that hopefully works.
All in all, I, in fact, do not need the solution to alter the IP in Godaddy's DNS for shlink to run accordingly, cause the issue was pointing the service to the right certificate (as illustrade in earlier post). But it is indeed interesting to know that there is a way to alter the IP at Godaddy when the case shall needed. Thanks for your tips so far. (y)
-- post merged: --

Here’s another option:
One more way to do it. :)
 
Upvote 0
The returned IP from GoDaddy is the loopback IP (127.0.0.1), a.k.a. localhost, and every device can use this to refer to itself.​
...​
So that's two issues to fix:​
I don't use GoDaddy so can't suggest a fix for the first problem.​

Is this anyhow a problem?. Could you give me a example about the supposed issue?
The issue with the GoDaddy query for "what IP is currently set for my domain" returning 127.0.0.1 is that it isn't your real WAN IP address, or previous WAN IP address.

A reason it may be 127.0.0.1 are that GoDaddy sets this as the 'parked' address until you change it. If that is the case then all is OK and, once you've changed it, the query should return the right WAN IP.

But if that wasn't the reason: DDNS providers don't like it when you repeatedly use the update API then the IP address hasn't changed. I remember DynDNS used to block accounts when this happened too often. So the reason may have been that the script query only ever got 127.0.0.1. This would then mean the script will always send an IP update every time you ran the script.

Anyway your follow-up post shows "34.102.136.180" as the current IP in GoDaddy. You should just confirm that this becomes your WAN IP once you believe that you've set it using the script.
 
Upvote 0
Last edited:
The issue with the GoDaddy query for "what IP is currently set for my domain" returning 127.0.0.1 is that it isn't your real WAN IP address, or previous WAN IP address.
I put it there manually.
A reason it may be 127.0.0.1 are that GoDaddy sets this as the 'parked' address until you change it. If that is the case then all is OK and, once you've changed it, the query should return the right WAN IP.
Maybe, but I had to wait 48 h to see it (if it happens).
But if that wasn't the reason: DDNS providers don't like it when you repeatedly use the update API then the IP address hasn't changed. I remember DynDNS used to block accounts when this happened too often. So the reason may have been that the script query only ever got 127.0.0.1. This would then mean the script will always send an IP update every time you ran the script.

Anyway your follow-up post shows "34.102.136.180" as the current IP in GoDaddy. You should just confirm that this becomes your WAN IP once you believe that you've set it using the script.
Got it.

The whole story: I set the IP manualy to "127.0.0.1" as well as other random IP's just to test if shlink would work as expected. Since as I stated afterwards shlink does work as it should independently of the IP set at Godaddy. Meanwhile than came the opportunity to change IP at Godaddy in automatic way via Task scheduler at DSM thinking it was necessary to shlink to work. So I gave it a try since I thought it could maybe interesting who knows implementing it when needed in a future. Then I set back to the original park IP "34.102.136.180" to test the task script modification suggested by you. That's it.
-- post merged: --

That's great. @fredbert saved the day as always :)

Here's another tip that might be applicable for your modem (gateway).
See if there's a static DNS option. Check under Network Application > DNS configuration.

It's useful.
Oh yeah, it is useful indeed. I even set two ddns but they stopped to work, don't know why (maybe because it's limited free service?), the only clue is I had to check my ddns service.
1617898637275.png

By the way, could you possible recommend ddns service for free or at its best cheap. I do currently use no-ip.com. Its setup is very limited and awkward. Thanks.
 
Upvote 0
The whole story: I set the IP manualy to "127.0.0.1" as well as other random IP's just to test if shlink would work as expected. Since as I stated afterwards shlink does work as it should independently of the IP set at Godaddy. Meanwhile than came the opportunity to change IP at Godaddy in automatic way via Task scheduler at DSM thinking it was necessary to shlink to work. So I gave it a try since I thought it could maybe interesting who knows implementing it when needed in a future. Then I set back to the original park IP "34.102.136.180" to test the task script modification suggested by you. That's it.
OK. I was only trying to help when you asked about why the script failed.
 
Upvote 0
I even set two ddns but they stopped to work,
The static DNS option on the gateway has nothing to do with DDNS. It's to statically bind an IP address to a domain name on the LAN. If you have a few internal hosts that you need to refer to internally by their FQDN, it's handy. So instead of enabling an internal DNS service this can be used.
Example:
mydomain.com 192.168.1.1

I do currently use no-ip.com. Its setup is very limited and awkward.
I'm using no ip. They use wizards or something like that. I prefer entering things manually on a line by line as the wizards can be confusing (to me). But It's working. What are you missing?
 
Upvote 0
The static DNS option on the gateway has nothing to do with DDNS. It's to statically bind an IP address to a domain name on the LAN. If you have a few internal hosts that you need to refer to internally by their FQDN, it's handy. So instead of enabling an internal DNS service this can be used.
Example:
mydomain.com 192.168.1.1
Sorry, I made a little confusion. A "D" too much, make all difference. :LOL:
I fear I don't have this feature you mention in the router.
1617969562777.png

I'm using no ip. They use wizards or something like that. I prefer entering things manually on a line by line as the wizards can be confusing (to me). But It's working. What are you missing?
Maybe I exaggerated a little. In fact, I meant was that I can't edit all the field that showed up at the moment when I created a hostname.
1617970355088.png

In the example above, record type isn't presented for editing. But it is perhaps so by design.
1617970544730.png
 
Upvote 0
I fear I don't have this feature you mention in the router.
Yes, it’s not there :(

I meant was that I can't edit all the field that showed up at the moment when I created a hostname.
That‘s what I meant. It’s all guided (instead of everything in a table) and I hate it. But you still can add the records. At least with the paid option as that’s what I’m using. Although I find it confusing. But I have to say, compared to my previous experience with another service provider, they’re light years ahead when it comes to availability.

In the example above, record type isn't presented for editing. But it is perhaps so by design.
You’ll have to use the options for each record but you can’t flip a record to something else (or I haven’t figured it out). I think they believe they’re making it easy. It’s actually worse doing it this way!
 
Upvote 0
Yes, it’s not there :(
This and other missing features found in this capped modem/router furnished by my provider makes me wish to acquire a 3rd party router with free and full configuration capability. The problem is that this Huawei router doesn't allow me to set it in bridge mode. The only way I think it would be possible instead is setting it in DMZ.

Have you ever had such an experience or heard about it how to get it to work satisfactorily or even if it would be recommended to be used it so from the security point of view?


That‘s what I meant. It’s all guided (instead of everything in a table) and I hate it. But you still can add the records. At least with the paid option as that’s what I’m using. Although I find it confusing. But I have to say, compared to my previous experience with another service provider, they’re light years ahead when it comes to availability.
(y)
You’ll have to use the options for each record but you can’t flip a record to something else (or I haven’t figured it out). I think they believe they’re making it easy. It’s actually worse doing it this way!
 
Upvote 0

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Yep this section. I would have expected to see the digest instead of {repo}:{tag}. With the repo digest...
Replies
5
Views
2,139

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Back
Top