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

Support serving Tiled from a sub-path. #283

Open
danielballan opened this issue Aug 8, 2022 · 10 comments
Open

Support serving Tiled from a sub-path. #283

danielballan opened this issue Aug 8, 2022 · 10 comments

Comments

@danielballan
Copy link
Member

No description provided.

@danielballan danielballan added this to the First beta release milestone Aug 8, 2022
@dylanmcreynolds
Copy link
Contributor

A common use case for this is combining tiled with other services and UI apps behind a single reverse proxy server (nginx, k8s ingress nginx, traefik, etc.)

Say you had a user interface that accessed tiled for some or all of its data. You would want several routes that your reverse proxy server could use for dispatching requests:

  • / The entry route to the user interface, no sub-path to bother your users with
  • /tiled The path to tiled
  • /another_service

This is really difficult to do today, because tiled can only process requests to /. The only solution that I know of here is to setup the reverse proxy to expose /tiled for external services (making it the public-facing url for tiled) and then re-write the path in every request before sending to tiled. This is a lot of work and gets confusing.

It would be better if we could configure the root path that tiled responds to.

@danielballan
Copy link
Member Author

For Future Us, remember this comment suggesting a way forward here: #347 (comment)

@danielballan
Copy link
Member Author

Addressed by #646 but needs docs. A working nginx config is over in bluesky/bluesky-pods#37.

@tacaswell
Copy link
Contributor

To be fair, #646 just makes it possible to configure the whole thing to sit behind nginx with no extra re-writing. The thing it does not do is move the /ui to / and the landing page with hints off to someplace else.

@dylanmcreynolds
Copy link
Contributor

I'm now confused.

With #646, can I somehow mount all of tiled to, say, http://localhost/tiled and see both the ui homepage run at that URL, and point the python tiled client to that URL? If so, I'm super excited.

@tacaswell
Copy link
Contributor

The ui is at http://localhost/tiled/ui and the API is at http://localhost/tiled/api

@dylanmcreynolds
Copy link
Contributor

And is tiled configurable? Could the by http://localhost/toms_awesome_data_server/ui?

@tacaswell
Copy link
Contributor

yes.

With the right nginx config (and a second tiled instance) you could even have http://localhost/toms_awesome_data_server/ui and http://localhost/dylans_awesome_data_server/ui running next to each other.

@danielballan
Copy link
Member Author

Config, lifted from bluesky/bluesky-pods#37:

        location ^~ /tiled/ {
            proxy_pass          http://tld:8000/;
            proxy_read_timeout 60s;

            # May not need or want to set Host. Should default to the above hostname.
            proxy_set_header          Host            $host;
            proxy_set_header          X-Forwarded-Host $host:11973;
            proxy_set_header          X-Real-IP       $remote_addr;
            proxy_set_header          X-Forwarded-For $proxy_add_x_forwarded_for;
        }

@tacaswell
Copy link
Contributor

should probably use $server_port rather than a hard-coded port number

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 a pull request may close this issue.

3 participants