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

Feature: Specify web root inside an env variable. #180

Closed
C10udburst opened this issue Nov 1, 2024 · 8 comments · Fixed by #183
Closed

Feature: Specify web root inside an env variable. #180

C10udburst opened this issue Nov 1, 2024 · 8 comments · Fixed by #183
Labels
enhancement New feature or request

Comments

@C10udburst
Copy link
Contributor

I would like to run this container behind nginx, at a subpath like example.com/convert/. Currently this is not possible.

I think adding an environment variable such as WEBROOT=/convert/ would allow such an usecase.

@raghuscsa316
Copy link

+1
I'm also trying to do the same thing.

@C4illin C4illin added the enhancement New feature or request label Nov 6, 2024
C4illin added a commit that referenced this issue Nov 6, 2024
@raghuscsa316
Copy link

raghuscsa316 commented Nov 6, 2024

Does not seem to be working, I'm afraid.

here is my docker run command:
docker run --detach
--name convertx01
--hostname convertx01
--publish published=3000,target=3000,mode=host
--mount type=bind,src=/container-data/convertx01/data,dst=/app/data
--env "ACCOUNT_REGISTRATION=false"
--env "JWT_SECRET=-removed-"
--env "HTTP_ALLOWED=true"
--env "ALLOW_UNAUTHENTICATED=true"
--env "AUTO_DELETE_EVERY_N_HOURS=24"
--env "WEBROOT=/convertx01"
convertx:2024.11

(in my case the container image was named convertx:2024.11, replace with whatever the image name you build with)

and here is my nginx proxy config:

location /convertx01/ {
proxy_pass http://convertx01:3000/;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_hide_header Server;
access_log /var/log/nginx/convertx.log main;
}

image

@C4illin
Copy link
Owner

C4illin commented Nov 6, 2024

What does the docker logs say? I copied your docker command and run it locally, and it works and respects WEBROOT

@raghuscsa316
Copy link

raghuscsa316 commented Nov 6, 2024

I quickly downloaded the project again and built the container again. But it still does not seem to be working I'm afraid.

Did you try accessing http://localhost:3000/webroot
or
proxy_pass http://localhost:3000 to nginx an nginx /webroot location?

http://localhost:3000/webroot isn't working for me. Logs are below (nothing too exciting). It does however work if I accessed http://localhost:3000/ directly. It prompts me to create an account.

If you did a proxy_pass, can you share your nginx config? I'm guessing you did some url rewrite?


🦊 Elysia is running at http://localhost:3000
Alpine Linux v3.18
GraphicsMagick 1.3.40 2023-01-14 Q16 http://www.GraphicsMagick.org/
resvg v0.44.0
Bun v1.1.34
assimp vVersion 5.2 -shared -st (GIT commit 0)
XeTeX 3.141592653-2.6-0.999995 (TeX Live 2023/Alpine Linux)
djxl v0.8.2 [AVX3,AVX2,SSE4,SSSE3,SSE2]
pandoc 3.1.2
vips-8.14.3
ffmpeg version 6.0.1 Copyright (c) 2000-2023 the FFmpeg developers
2 | var L1=Object.create;var{getPrototypeOf:T1,defineProperty:k2,getOwnPropertyNames:E1}=Object;var q1=Object.prototype.hasOwnProperty;var U2=($,W,X)=>{X=$!=null?L1(T1($)):{};const Z=W||!$||!$.__esModule?k2(X,"default",{value:$,enumerable:!0}):X;for(let j of E1($))if(!q1.call(Z,j))k2(Z,j,{get:()=>$[j],enumerable:!0});return Z};var H1=($,W)=>()=>(W||$((W={exports:{}}).exports,W),W.exports);var o0=H1((G8,$1)=>{function _3($){var W=$.indexOf("%");if(W===-1)return $;var X=$.length,Z="",j=0,J=0,Y=W,G=o2;while(W>-1&&W<X){var K=e2($[W+1],4),B=e2($[W+2],0),U=K|B,w=N2[U];if(G=N2[256+G+w],J=J<<6|U&N2[364+w],G===o2)Z+=$.slice(j,Y),Z+=J<=65535?String.fromCharCode(J):String.fromCharCode(55232+(J>>10),56320+(J&1023)),J=0,j=W+3,W=Y=$.indexOf("%",j);else if(G===w3)return null;else{if(W+=3,W<X&&$.charCodeAt(W)===37)continue;return null}}return Z+$.slice(j)}function e2($,W){var X=F3[$];return X===void 0?255:X<<W}var o2=12,w3=0,N2=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
3 |  * cookie
4 |  * Copyright(c) 2012-2014 Roman Shtylman
5 |  * Copyright(c) 2015 Douglas Christopher Wilson
6 |  * MIT Licensed
7 |  */var z2=Q3,D2=Y3;var J3=Object.prototype.toString,a0=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;var X1=U2(o0(),1);class w0{$;W;X;constructor($,W,X={}){this.name=$;this.jar=W;this.initial=X}get cookie(){return this.jar[this.name]??this.initial}set cookie($){if(!(this.name in this.jar))this.jar[this.name]=this.initial;this.jar[this.name]=$}get setCookie(){if(!(this.name in this.jar))this.jar[this.name]=this.initial;return this.jar[this.name]}set setCookie($){this.cookie=$}get value(){return this.cookie.value}set value($){this.setCookie.value=$}get expires(){return this.cookie.expires}set expires($){this.setCookie.expires=$}get maxAge(){return this.cookie.maxAge}set maxAge($){this.setCookie.maxAge=$}get domain(){return this.cookie.domain}set domain($){this.setCookie.domain=$}get path(){return this.cookie.path}set path($){this.setCookie.path=$}get secure(){return this.cookie.secure}set secure($){this.setCookie.secure=$}get httpOnly(){return this.cookie.httpOnly}set httpOnly($){this.setCookie.httpOnly=$}get sameSit

error: NOT_FOUND
 code: "NOT_FOUND"

      at new A0 (/app/node_modules/elysia/dist/bun/index.js:7:29780)
      at anonymous (file:///app/node_modules/elysia/dist/bun/index.js:23:36)
      at compile (/app/node_modules/elysia/src/index.ts:5894:6)
      at processTicksAndRejections (unknown:7:39)

jobId set to: 1
jobId set to: 2

@C4illin
Copy link
Owner

C4illin commented Nov 6, 2024

You have to switch to the correct branch. It isn't merged to the main branch yet

I didnt use nginx just local

@raghuscsa316
Copy link

Ah! My mistake.

Just tried with the correct branch, tried a few conversions and all worked as expected.

Cheers!

@C10udburst
Copy link
Contributor Author

C10udburst commented Nov 6, 2024

Works for me as well, thank you.

@C4illin
Copy link
Owner

C4illin commented Nov 6, 2024

Thanks for testing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants