0

I am using the package m2mtech/weblate-translation-provider to push Symfony translations to a self-hosted Weblate instance.

When calling this command:

bin/console translation:push --domains=messages weblate -vv

I get the following error in the logs:

INFO [http_client] Request: "GET https://WEBLATE_DOMAIN/api/projects/MY_PROJECT/components/"
INFO [http_client] Response: "200 https://WEBLATE_DOMAIN/api/projects/MY_PROJECT/components/"
INFO [http_client] Request: "GET http://WEBLATE_DOMAIN/api/components/MY_PROJECT/messages/translations/"
INFO [http_client] Redirecting: "308 https://WEBLATE_DOMAIN/api/components/MY_PROJECT/messages/translations"
INFO [http_client] Response: "404 https://WEBLATE_DOMAIN/api/components/MY_PROJECT/messages/translations"

In TranslationApi.php line 66:
                                                               
  [Symfony\Component\Translation\Exception\ProviderException]  
  Unable to get weblate components translations for messages.

Why does the last URL get a 404 response? Did I set up Weblate incorrectly or am using the command line tool wrong?

Seb33300
  • 7,464
  • 2
  • 40
  • 57
tobias47n9e
  • 2,233
  • 3
  • 28
  • 54
  • 1
    It seems that your weblate instance is unaware that it is behind an HTTPS proxy and is therefore generating invalid URLs that are "fixed" by your proxy. Please check if you have set ENABLE_HTTPS, HTTP_X_FORWARDED_FOR et al. correctly. – Martin Mandl Aug 27 '22 at 07:28

2 Answers2

1

The URL is missing the trailing slash - it should be https://WEBLATE_DOMAIN/api/components/MY_PROJECT/messages/translations/

Michal Čihař
  • 9,799
  • 6
  • 49
  • 87
1

The second request is using HTTP. You should replace it by HTTPS to prevent the broken redirect.

Seb33300
  • 7,464
  • 2
  • 40
  • 57