Skip to content

Support for a base url option #20

@bmarsaud

Description

@bmarsaud

Hi! Thanks for your work on this image.

I'm publishing an SPA on a subpath, let's say on https://example.com/app/. I want to serve :

  • My index.html on /app
  • My static assets on /app/assets/xxxx
  • Redirect my SPA routes (/app/route1 for instance) to the index.html

For now, my static assets are not served properly because it will search for /app/assets/xxxx files ont the fs instead of /assets/xxxx.
A base url option, would allow to match the incoming URL with the file path.

A workaround is to copy the static assets to the "base url path" in the image fs while keeping the index.html on root :

FROM devforth/spa-to-http:latest AS runner
ARG BASE_URL="app"
RUN mkdir -p ${BASE_URL}
COPY --from=build /usr/src/app/dist ${BASE_URL}
RUN mv ${BASE_URL}/index.html index.html

But I think a runtime option would make it cleaner.
It's the same issue as #11 that was closed

Would like to submit a PR but i don't know GO tbh!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions