Why does PathPrefixStrip work when PathPrefix won't?

眉间皱痕 提交于 2019-12-06 03:13:09

The pathPrefix configuration in GatsbyJS means that every link of your website will be prepended with /environment/test (see documentation), but this does not mean that on the container running the website, the page is actually hosted on this path. In your situation, it seems it is not the case.

This means that when connecting via Traefik with the PathPrefixStrip, when in your browser you click on a link:

  1. The browser requests /environment/test/page
  2. Traefik translates this to a request to the container for /page
  3. The container is actually serving files on / so it answers with the page

When connecting via Traefik with the PathPrefix:

  1. The browser requests /environment/test/page
  2. Traefik translates this to a request to the container for /environment/test/page
  3. The container is actually serving files on / so it doesn't find the page.

Hence, you are confusing the pathPrefix setting of a website with the path from which the very same website is served.

The alternative to the current situation would thus be to serve the website under /environment/test/ and use PathPrefix with traefik.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!