Skip to content

Conversation

@wkulesza
Copy link

@wkulesza wkulesza commented Oct 8, 2024

Modified for testing (didn't use Flow framework) to use Valhalla routing instead of Graphhopper.
To configure, in configurations/default/env.yml add:
VALHALLA_URL: "https://valhalla1.openstreetmap.de/route"

This will work with the stock Valhalla demo - please don't use in production.

When you replace this URL with your own hosted version of Valhalla (either in docker from https://github.com/gis-ops/docker-valhalla or standard, compiled from here: https://github.com/valhalla/valhalla) and run Datatools docker with this url, it will end up with CORS errors.

My setup for either Apache or Nginx is using following header set:

location / {
        proxy_pass http://127.0.0.1:8002; // set to your valhalla instance
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';

    if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' 'https://datatools.goeuropa.net';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';
        return 204;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants