mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #906] Postwoman Docker Container behind Reverse Proxy #322
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#322
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @woigl on GitHub (May 27, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/906
We want to use the Postwoman Docker container begin an NGINX reverse proxy with a subpath i.e. http://hostname/postwoman
This is an extract of the NGINX config:
We would expect that the reverse proxy path would be used for the requests, but it seems not to work.

See this image:
We are using the Docker Image v1.9.7.
How can we solve this?
@liyasthomas commented on GitHub (May 27, 2020):
@JanoschDeurer can you help me to resolve this issue?
@JanoschDeurer commented on GitHub (May 28, 2020):
@liyasthomas Yes, i'll give it a look later today
@JanoschDeurer commented on GitHub (May 28, 2020):
I wrote a small test setup and got the same errors.
This doesn't look like a Docker problem to me. I'm not really good with web development, but it looks to me like the paths to the .js files in the head section of the index.html should be relative links instead of absolute ones. @liyasthomas if you give me a hint where these links are generated I'll test it.
Here is my test setup:
@AndrewBastin commented on GitHub (May 28, 2020):
The
index.htmlfile is generated by the Nuxt build process and there is no way currently to make Nuxt generate relative URLs (see issue https://github.com/nuxt/nuxt.js/issues/1380).If you are using subpaths, I am pretty sure you can override the
router.baseto generate code based on the subpath.@JanoschDeurer commented on GitHub (May 29, 2020):
I looked into the
nuxt.config.jsfile and it seems there is already an evn variable that does exactly what we need:https://github.com/liyasthomas/postwoman/blob/master/nuxt.config.js#L17
But I think this is only triggered on build time right?
@liyasthomas commented on GitHub (May 29, 2020):
@JanoschDeurer yes you're right - it's only triggered at the build time. Let me know if there's a workaround that would allow docker deployment in a subpath.
@JanoschDeurer commented on GitHub (May 29, 2020):
What we can do is add an env variable and then one has to set it in the Dockerfile or pass it to docker build with
However, I can't get this to work in my local setup, maybe the line I referenced above is not the right one, because I changed that variable and it didn't have any effect for me.
@liyasthomas commented on GitHub (May 30, 2020):
@woigl change the
router.basevalue to your desired subpath in nuxt.config.jsie: to serve image in
/pwsubpath, make the following change:nuxt.config.js
for convenience, you can set:
and pass it to docker build with:
shall we provide an env var in
.envforrouter.base?@woigl commented on GitHub (May 30, 2020):
@liyasthomas does this mean, that we have to make a full build or just a build based on your image?
Can you provide me a sample Dockerfile?
@liyasthomas commented on GitHub (May 30, 2020):
Build have to be tweaked on nuxt.config.js file. Current docker file works good.
@JanoschDeurer commented on GitHub (May 30, 2020):
@woigl you can set an environment variable in the Dockerfile by adding:
to your Dockerfile.
If you want to set the variable with:
use
ARGinstead:In any case you always have to run a
docker buildwhen you change the path. And to your question, yes this build has to be for the container in this project, not one that is based on it.I know this was not your question, but in my personal experience it is often a lot easier to use subdomains instead of path based routing, also I can recommend using traefik as a reverse proxy, it has a really nice docker integration and it handles LetsEncrypt for you.
@W1M0R commented on GitHub (Jun 10, 2020):
How can I get this to work if I make use of the image on DockerHub?
@JanoschDeurer commented on GitHub (Jun 10, 2020):
@W1M0R you can't really. Setting the path variable must happen before
npm buildis run. Maybe you can run the build step again, but I think it would make more sense to just alter the Dockerfile in this project for your purposes.@e-mikh commented on GitHub (Mar 17, 2023):
any update on this with current version? still possible?