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

Vhost Path Prefix for the Development Server ? #57

Closed
andyl opened this issue Jan 5, 2024 · 4 comments
Closed

Vhost Path Prefix for the Development Server ? #57

andyl opened this issue Jan 5, 2024 · 4 comments

Comments

@andyl
Copy link
Contributor

andyl commented Jan 5, 2024

I'd like to host Tableau sites on google pages. Google Pages provides a base-url like https://andyl.github.io/stat1, where the stat1 prefix is a virtual host identifier tied to the repo at https://github.com/andyl/stat1.

Also: in NGINX it is common to use a location prefix for Vhosts. Here is an example NGINX config snippet:

server {
    listen 80;
    server_name myhost.com;

    location /site1 {
        # Configuration for site1 - eg the root directive to a directory
        # root /var/www/site1;
    }

    location /site2 {
        # Configuration for site2
        # Similar configuration as site1, adjusted for site2 specifics
    }

    # Other configuration...
}

As a developer, I'd like to write my Tableau app with the Path Prefix built in to all my hard-coded hrefs. No problem in production. But in development, I don't know how to configure mix tableau.server to use a Vhost path prefix. So I can build a site that works in development, or production, but not both.

Is there a way to configure a path prefix for the development server?

@paradox460
Copy link
Contributor

You can configure your permalinks via elixir's standard configuration model. For dev you simply put the config in dev.exs, and it will be merged into the standard config.exs

config.exs:

config :tableau, Tableau.PostExtension,
  enabled: true,
  future: true,
  layout: "MySite.PostLayout",

dev.exs:

config :tableau, Tableau.PostExtension,
    permalink: "/dev-vhost/blog/:year-:month-:day-:title"

prod.exs:

config :tableau, Tableau.PostExtension,
    future: false,
    permalink: "/prod-vhost/blog/:year-:month-:day-:title"

Your actual config will likely differ, this is just an illustrative example

@andyl
Copy link
Contributor Author

andyl commented Jan 5, 2024

Thanks - good info! In my case, I've got hrefs hard coded in the markdown files. Also would need to adjust hrefs for the CSS and JS links in the layouts. Easier to do in elixir source, but hope to avoid if possible. ;-)

@mhanberg
Copy link
Collaborator

mhanberg commented Jan 5, 2024

I recall having this problem in the past.

I rewrote our company blog in Ghost, and they reverse proxied it from the actual site through nginx.

but, then all the links were messed up cuz they used relative links, and the domain had the /blog subfolder that the site didn't know about.

I think base URL is fine here, I think

@mhanberg
Copy link
Collaborator

mhanberg commented Jan 8, 2024

released in v0.15

@mhanberg mhanberg closed this as completed Jan 8, 2024
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

No branches or pull requests

3 participants