LT Firefox works with the cloud, but not with the Docker. Docker works, but not with Firefox

Hello hello,

I am trying to get a local instance of LT working but I have a strange problem:

The Firefox addon works flawlessly when the Cloud server is selected.

Playing around with the Docker (docker pull erikvl87/languagetool , docker run --rm -p 8010:8010 erikvl87/languagetool):

http://localhost:8010/v2/check?text=corect&language=en-US
yields

{"software":{"name":"LanguageTool","version":"6.1","buildDate":"2023-04-04 07:15:59 +0000","apiVersion":1,"premium":false,"premiumHint":"You might be missing errors only the Premium version can find. Contact us at support<at>languagetoolplus.com.","status":""},"warnings":{"incompleteResults":false},"language":{"name":"English (US)","code":"en-US","detectedLanguage":{"name":"English (US)","code":"en-US","confidence":0.704827,"source":""}},"matches":[{"message":"Possible spelling mistake found.","shortMessage":"Spelling mistake","replacements":[{"value":"correct"},{"value":"core ct"}],"offset":0,"length":6,"context":{"text":"corect","offset":0,"length":6},"sentence":"corect","type":{"typeName":"UnknownWord"},"rule":{"id":"MORFOLOGIK_RULE_EN_US","description":"Possible spelling mistake","issueType":"misspelling","category":{"id":"TYPOS","name":"Possible Typo"}},"ignoreForIncompleteSentence":false,"contextForSureMatch":0}],"sentenceRanges":[[0,6]]}

As you can see, the error in corect was found succesfully.
http://localhost:8010/v2/languages
yields

[{"name":"Arabic","code":"ar","longCode":"ar"},{"name":"Asturian","code":"ast","longCode":"ast-ES"},{"name":"Belarusian","code":"be","longCode":"be-BY"},{"name":"Breton","code":"br","longCode":"br-FR"},{"name":"Catalan","code":"ca","longCode":"ca-ES"},{"name":"Catalan (Valencian)","code":"ca","longCode":"ca-ES-valencia"},{"name":"Catalan (Balearic)","code":"ca","longCode":"ca-ES-balear"},{"name":"Danish","code":"da","longCode":"da-DK"},{"name":"German","code":"de","longCode":"de"},{"name":"German (Germany)","code":"de","longCode":"de-DE"},{"name":"German (Austria)","code":"de","longCode":"de-AT"},{"name":"German (Swiss)","code":"de","longCode":"de-CH"},{"name":"Simple German","code":"de-DE-x-simple-language","longCode":"de-DE-x-simple-language"},{"name":"Greek","code":"el","longCode":"el-GR"},{"name":"English","code":"en","longCode":"en"},{"name":"English (US)","code":"en","longCode":"en-US"},{"name":"English (GB)","code":"en","longCode":"en-GB"},{"name":"English (Australian)","code":"en","longCode":"en-AU"},{"name":"English (Canadian)","code":"en","longCode":"en-CA"},{"name":"English (New Zealand)","code":"en","longCode":"en-NZ"},{"name":"English (South African)","code":"en","longCode":"en-ZA"},{"name":"Esperanto","code":"eo","longCode":"eo"},{"name":"Spanish","code":"es","longCode":"es"},{"name":"Spanish (voseo)","code":"es","longCode":"es-AR"},{"name":"Persian","code":"fa","longCode":"fa"},{"name":"French","code":"fr","longCode":"fr"},{"name":"Irish","code":"ga","longCode":"ga-IE"},{"name":"Galician","code":"gl","longCode":"gl-ES"},{"name":"Italian","code":"it","longCode":"it"},{"name":"Japanese","code":"ja","longCode":"ja-JP"},{"name":"Khmer","code":"km","longCode":"km-KH"},{"name":"Dutch","code":"nl","longCode":"nl"},{"name":"Dutch (Belgium)","code":"nl","longCode":"nl-BE"},{"name":"Polish","code":"pl","longCode":"pl-PL"},{"name":"Portuguese","code":"pt","longCode":"pt"},{"name":"Portuguese (Portugal)","code":"pt","longCode":"pt-PT"},{"name":"Portuguese (Brazil)","code":"pt","longCode":"pt-BR"},{"name":"Portuguese (Angola preAO)","code":"pt","longCode":"pt-AO"},{"name":"Portuguese (Moçambique preAO)","code":"pt","longCode":"pt-MZ"},{"name":"Romanian","code":"ro","longCode":"ro-RO"},{"name":"Russian","code":"ru","longCode":"ru-RU"},{"name":"Slovak","code":"sk","longCode":"sk-SK"},{"name":"Slovenian","code":"sl","longCode":"sl-SI"},{"name":"Swedish","code":"sv","longCode":"sv"},{"name":"Tamil","code":"ta","longCode":"ta-IN"},{"name":"Tagalog","code":"tl","longCode":"tl-PH"},{"name":"Ukrainian","code":"uk","longCode":"uk-UA"},{"name":"Chinese","code":"zh","longCode":"zh-CN"},{"name":"Dutch","code":"nl","longCode":"nl-NL"},{"name":"Simple German","code":"de-DE-x-simple-language","longCode":"de-DE-x-simple-language-DE"},{"name":"Spanish","code":"es","longCode":"es-ES"},{"name":"Italian","code":"it","longCode":"it-IT"},{"name":"Persian","code":"fa","longCode":"fa-IR"},{"name":"Swedish","code":"sv","longCode":"sv-SE"},{"name":"German","code":"de","longCode":"de-LU"},{"name":"French","code":"fr","longCode":"fr-FR"}]

So, from that I would conclude that the Docker itself works fine as well.

What does not work, however, is the Addon in combination with the Docker. I have set the server to http://localhost:8010. But any time I try to check something, I get an error 400:

2023-05-11 09:54:26.932 GMT INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /check
2023-05-11 09:54:26.933 GMT INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /check
2023-05-11 09:54:26.933 GMT INFO  org.languagetool.server.LanguageToolHttpHandler An error has occurred: 'This is the LanguageTool API. You have not specified any parameters. Please see https://languagetool.org/http-api/swagger-ui/#/default', sending HTTP code 400. Access from 172.17.0.1, HTTP user agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0, User agent param: webextension-firefox-ng, v: 6.2.5, Referrer: null, language: auto, h: 1, r: 185, time: 1m: TEXTLEVEL_ONLY, l: PICKY, iID: 25562:1683798866809, Stacktrace follows:org.languagetool.server.BadRequestException: This is the LanguageTool API. You have not specified any parameters. Please see https://languagetool.org/http-api/swagger-ui/#/default
        at org.languagetool.server.LanguageToolHttpHandler.handle(LanguageToolHttpHandler.java:195)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
        at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:848)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:817)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

2023-05-11 09:54:26.933 GMT INFO  org.languagetool.server.LanguageToolHttpHandler An error has occurred: 'This is the LanguageTool API. You have not specified any parameters. Please see https://languagetool.org/http-api/swagger-ui/#/default', sending HTTP code 400. Access from 172.17.0.1, HTTP user agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0, User agent param: webextension-firefox-ng, v: 6.2.5, Referrer: null, language: auto, h: 2, r: 186, time: 0m: ALL_BUT_TEXTLEVEL_ONLY, l: PICKY, iID: 25562:1683798866809, Stacktrace follows:org.languagetool.server.BadRequestException: This is the LanguageTool API. You have not specified any parameters. Please see https://languagetool.org/http-api/swagger-ui/#/default
        at org.languagetool.server.LanguageToolHttpHandler.handle(LanguageToolHttpHandler.java:195)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
        at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:848)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:817)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

2023-05-11 09:54:26.933 GMT INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 1ms; sending code 400
2023-05-11 09:54:26.933 GMT INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 0ms; sending code 400

I am clueless about how to debug this. Do you have any idea? Do you need any more information? I have already disabled all other addons.

Hi Marcello, is the LT server started with the --allow-origin parameter? It probably should.

I did not change anything from the Docker, so I don’t know about that.

But I actually ended up solving this issue just now – setting the URL to http://localhost:8010/v2 instead of http://localhost:8010 was all it took. :slight_smile:

Thanks for your solution!
This hint should be written into the server install document, as it will save every admin 2 hours!