Back to LanguageTool Homepage - Privacy - Imprint

Local LT server - Cross-Origin Request Blocked

The goal is to run a local LT server on a windows sever then use it as a browser add-on as a other server.

When i run the command (java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8080 --public --config server.properties) without --allow-origin “*” it works in google chrome but not in firefox.

When i run the command (java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8080 --public --config server.properties --allow-origin “") with --allow-origin "” i’m not able to run it.

PS F:\LanguageTool-stable\LanguageTool-5.4> cd F:\LanguageTool-stable\LanguageTool-5.4
java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8080 --public --allow-origin “"
Usage: HTTPServer [–config propertyFile] [–port|-p port] [–public]
–config FILE a Java property file (one key=value entry per line) with values for:
‘maxTextLength’ - maximum text length, longer texts will cause an error (optional)
‘maxTextHardLength’ - maximum text length, applies even to users with a special secret ‘token’ parameter (optional)
‘secretTokenKey’ - secret JWT token key, if set by user and valid, maxTextLength can be increased by the user (optional)
‘maxCheckTimeMillis’ - maximum time in milliseconds allowed per check (optional)
‘maxErrorsPerWordRate’ - checking will stop with error if there are more rules matches per word (optional)
‘maxSpellingSuggestions’ - only this many spelling errors will have suggestions for performance reasons (optional,
affects Hunspell-based languages only)
‘maxCheckThreads’ - maximum number of threads working in parallel (optional)
‘cacheSize’ - size of internal cache in number of sentences (optional, default: 0)
‘cacheTTLSeconds’ - how many seconds sentences are kept in cache (optional, default: 300 if ‘cacheSize’ is set)
‘requestLimit’ - maximum number of requests per requestLimitPeriodInSeconds (optional)
‘requestLimitInBytes’ - maximum aggregated size of requests per requestLimitPeriodInSeconds (optional)
‘timeoutRequestLimit’ - maximum number of timeout request (optional)
‘requestLimitPeriodInSeconds’ - time period to which requestLimit and timeoutRequestLimit applies (optional)
‘languageModel’ - a directory with ‘1grams’, ‘2grams’, ‘3grams’ sub directories which contain a Lucene index
each with ngram occurrence counts; activates the confusion rule if supported (optional)
‘word2vecModel’ - a directory with word2vec data (optional), see
https://github.com/languagetool-org/languagetool/blob/master/languagetool-standalone/CHANGES.md#word2vec
‘fasttextModel’ - a model file for better language detection (optional), see
Language identification · fastText
‘fasttextBinary’ - compiled fasttext executable for language detection (optional), see
Get started · fastText
‘maxWorkQueueSize’ - reject request if request queue gets larger than this (optional)
‘rulesFile’ - a file containing rules configuration, such as .langugagetool.cfg (optional)
‘warmUp’ - set to ‘true’ to warm up server at start, i.e. run a short check with all languages (optional)
‘blockedReferrers’ - a comma-separated list of HTTP referrers (and ‘Origin’ headers) that are blocked and will not be serve
d (optional)
‘disabledRuleIds’ - a comma-separated list of rule ids that are turned off for this server (optional)
Spellcheck-only languages: You can add simple spellcheck-only support for languages that LT doesn’t
support by defining two optional properties:
‘lang-xx’ - set name of the language, use language code instead of ‘xx’, e.g. lang-tr=Turkish
‘lang-xx-dictPath’ - absolute path to the hunspell .dic file, use language code instead of ‘xx’, e.g.
lang-tr-dictPath=/path/to/tr.dic. Note that the same directory also needs to
contain a common_words.txt file with the most common 10,000 words (used for better language detectio
n)
–port, -p PRT port to bind to, defaults to 8081 if not specified
–public allow this server process to be connected from anywhere; if not set,
it can only be connected from the computer it was started on
–allow-origin ORIGIN set the Access-Control-Allow-Origin header in the HTTP response,
used for direct (non-proxy) JavaScript-based access from browsers;
example: --allow-origin "

–verbose, -v in case of exceptions, log the input text (up to 500 characters)
–languageModel a directory with ‘1grams’, ‘2grams’, ‘3grams’ sub directories (per language)
which contain a Lucene index (optional, overwrites ‘languageModel’
parameter in properties files)
–word2vecModel a directory with word2vec data (optional), see
https://github.com/languagetool-org/languagetool/blob/master/languagetool-standalone/CHANGES.md#word2vec

PS F:\LanguageTool-stable\LanguageTool-5.4>

i tried signle quotes ( --allow-origin ‘*’) too but no luck. Any assistance is greatly appreciated.

Have you tried --allow-origin "*" with exactly these types of quotes? There are different ways to type quote characters, and I think you need these.

@dnaber yes i tried but no luck.

You’re not running it directly from the command-line but somewhere else, aren’t you? I think it (= the software where you call it) might get confused by the quote characters, but I’m not sure how to solve that.

@dnaber Yes i’m using powershell. I tried with command-line same issue.
LT cmd error

Could there be any invisible special characters in your command? Have you tried typing it in manually?

@dnaber yes tried typing it in manually but still not luck.