Back to LanguageTool Homepage - Privacy - Imprint

Attempting to use local server is resulting in gateway timeout (Error code 504)


#1

I am trying to use the local server with my Firefox addon, but the addon gives me a 504 error (which I assume is Gateway Timeout in HTTP).

I have correctly started my server and I am able to confirm that it is working by visiting this URL: http://localhost:49152/v2/check?language=en-US&text=A%20quick%20brown%20fox%20jumps%20over%20the%20lazy%20dog

But when I try to check the same text (A quick brown fox jumps over the lazy dog) in Firefox, the extension gives me an error: Cannot connect to http://localhost:49152/v2 (#1, code=504)

Here is my server’s output:

TheDcoder@BeastLappy ~/S/LanguageTool> java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 49152
2019-02-05 03:30:39 +0000 Not setting up database access, dbDriver is not configured
WARNING: running in HTTP mode, consider using org.languagetool.server.HTTPSServer for encrypted connections
Setting up thread pool with 10 threads
Starting LanguageTool 4.4 (build date: 2018-12-27 10:19) server on http://localhost:49152...
Server started
2019-02-05 09:00:48 +0530 WARN  o.l.l.LanguageIdentifier Cannot consider noopLanguages because not in fastText mode: [en]
2019-02-05 03:30:50 +0000 Check done: 41 chars, en-GB (mother tongue: en)[auto], #1, null, 0 matches, 1711ms, agent:webextension-firefox-ng, v:2.0.28, sent, q:0, h:2, dH:1, m:textlevel_only
2019-02-05 03:30:50 +0000 Check done: 41 chars, en-GB (mother tongue: en)[auto], #1, null, 0 matches, 1820ms, agent:webextension-firefox-ng, v:2.0.28, sent, q:0, h:1, dH:1, m:all_but_textlevel_only

I am using Fedora 29 if that makes any difference. Thanks for the help in advance! :slight_smile:


(Daniel Naber) #2

You need to add --allow-origin '*' to the command line so the browser doesn’t run into security limits (“CORS”).


#3

Nice! It is now working :smile:

I find it a bit strange how the server allowing cross-orgin request is solving the issue… why does CORS matter if the JavaScript is already able to communicate with our server? According to my logic, the server doesn’t need to set CORS because it is not sending any scripts which need cross-origin access.

Also, maybe we should add this information to the wiki.


(Daniel Naber) #4

Indeed, I have added this to the Wiki (it only seems to be needed for Firefox, IIRC).


(Lodewijk Arie van Brienen) #5

I once read that firefox is set to treat file:\ calls that do not resolve within the page’s root (EG: “C:/ColorLib/ColorLib.js” instead of something in “C:/WebTest/test7”) as being cross origin.


(Daniel Naber) #6

I once read that firefox is set to treat file:\

This is unrelated to file: URLs, the local server also uses http:


#7

Excellent! Thanks, that should be sufficient for now :slight_smile: