Error: Panel cannot connect to API

Hi there,

I have this wierd problem. Today I moved my site to a new server. so far so good. on my macbook I can login to the panel without problems. but on my iphone when I want to login to the panel i get the error message: the Panel cannot connect to the API
also other users have the same problem. nerver ever had this problem with the panel…

Does anyone has any ideas how to solve this?

regards,
timo

Update:
now I can’t even login with my macbook anymore.

How did you move and from where to where?

How did you access the site (by which domain name) before and after moving?

I moved the files via SFTP. And what do you mean by where to where? The hosting company or what?

The domain changed, yes.

Did you make sure to not copy the files in site/cache, site/sessions, and media, except for the index.html file therein? But copy the “hidden” files (starting with a dot)?

I mean from local to a remote server or from one remote to another?

If the domain changed, there shouldn’t be a problem with cached domain name entries. On the other hand, did you check for hardcoded URLs which contain the domain name?

Have you turned on debug in your config? If not, then please do so and check your dev tools for errors.

Thanks @Adspectus and @texnixe

I will check your hints and report back if it’s still an issue. I have the feeling I that I did copy the session and media folders. But I need to check first

I think I have something. When I’m trying to open the panel, I need to type https://…/panel if not the browser tries to open it with http://…/panel

So I think I need to adjust the .htaccess? so it automatically uses https?

This is the content of the htaccess file:

# Kirby .htaccess
# revision 2020-06-15

# rewrite rules
<IfModule mod_rewrite.c>

# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on

# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder;
# otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite,
# set the RewriteBase to:
#
# RewriteBase /mysite

# In some environments it's necessary to
# set the RewriteBase to:
#
RewriteBase /

# block files and folders beginning with a dot, such as .git
# except for the .well-known folder, which is used for Let's Encrypt and security.txt
RewriteRule (^|/)\.(?!well-known\/) index.php [L]

# block all files in the content folder from being accessed directly
RewriteRule ^content/(.*) index.php [L]

# block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) index.php [L]

# block direct access to Kirby and the Panel sources
RewriteRule ^kirby/(.*) index.php [L]

# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

</IfModule>

# pass the Authorization header to PHP
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

# compress text file responses
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

Example of forcing https in your .htaccess: How to redirect HTTP to HTTPS Using .htaccess

There are also a lot of examples here on the forum, with or without www