Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the Context Path #1104

Open
rigsbyjt opened this issue Apr 24, 2024 · 1 comment
Open

Set the Context Path #1104

rigsbyjt opened this issue Apr 24, 2024 · 1 comment
Labels
question There's no such thing as a stupid question

Comments

@rigsbyjt
Copy link

I want to run GROBID via docker with a context path that is not simply '/'

I have reviewed the configuration files in grobid-home/config . I see howto change the ports and other configuration changes.

I have searched through the code to find the options and cannot find it.

The changes to grobid.yaml can be instantiated with something like

docker run --rm --gpus all --init -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.7.1-SNAPSHOT

Basically I want to access GROBID through

https://localhost:8080/grobid/

instead of

https://localhost:/8070

I was able to get the port part to work.

@lfoppiano
Copy link
Collaborator

lfoppiano commented Apr 24, 2024

Hi @rigsbyjt,
theoretically, you can change the context root programmatically (

), however it's not recommended as you would need to either rebuild the docker image or run Grobid natively, and the service might break the convention with other projects, such as the python client and so on.

However if what you need is to make Grobid accessible behind an Apache service, since it's a stateless service, you could configure a reverse proxy in the Apache configuration. The user interface works nicely under any context-root.

Given a standard Apache configuration, you would need something like:

        RewriteRule                  ^/grobid$ /grobid/ [R]
        ProxyPass                      /grobid http://localhost:8070
        ProxyPassReverse        /grobid http://localhost:8070

If you haven't done it already, you might need to enable both http_rewrite and http_proxy (I don't remember the exact names) in the apache configuration.

In this way the URL of the service will be http://apache_service/grobid, and the API can be reached as http://apache_service/grobid/api/service_to_call.

@lfoppiano lfoppiano added the question There's no such thing as a stupid question label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question There's no such thing as a stupid question
Projects
None yet
Development

No branches or pull requests

2 participants