[GH-ISSUE #176] How to run with prefix /foo with a remote proxy? #108

Open
opened 2026-02-27 10:15:45 +03:00 by kerem · 14 comments
Owner

Originally created by @MIvanchev on GitHub (Jul 8, 2025).
Original GitHub issue: https://github.com/matze/wastebin/issues/176

When using wastebin with nginx as reverse proxy I can reach the site through https://<addr>/foo but then all the resources are fetched through https://<addr>. Any way to fix that?

Originally created by @MIvanchev on GitHub (Jul 8, 2025). Original GitHub issue: https://github.com/matze/wastebin/issues/176 When using wastebin with nginx as reverse proxy I can reach the site through `https://<addr>/foo` but then all the resources are fetched through `https://<addr>`. Any way to fix that?
Author
Owner

@MIvanchev commented on GitHub (Jul 8, 2025):

P.S.

wastebin probably needs to support X-Forwared-Prefix.

<!-- gh-comment-id:3049642824 --> @MIvanchev commented on GitHub (Jul 8, 2025): P.S. wastebin probably needs to support `X-Forwared-Prefix`.
Author
Owner

@matze commented on GitHub (Jul 8, 2025):

There used to be an option to set a prefix but from a technical standpoint it was too cumbersome to keep. So Forwarded (it's an actual standard header) is probably to the way to do it. But it requires quite a bit of change, so I can't promise anything at this point.

<!-- gh-comment-id:3050104123 --> @matze commented on GitHub (Jul 8, 2025): There used to be an option to set a prefix but from a technical standpoint it was too cumbersome to keep. So `Forwarded` (it's an actual standard header) is probably to the way to do it. But it requires quite a bit of change, so I can't promise anything at this point.
Author
Owner

@MIvanchev commented on GitHub (Jul 8, 2025):

Thanks! That's actually a significant disadvantage IMO if prefixes aren't supported. The cumbersome option is better than nothing.

<!-- gh-comment-id:3050136175 --> @MIvanchev commented on GitHub (Jul 8, 2025): Thanks! That's actually a significant disadvantage IMO if prefixes aren't supported. The cumbersome option is better than nothing.
Author
Owner

@matze commented on GitHub (Jul 8, 2025):

I won't bring back the option but rather extract that info from a Forwarded header.

<!-- gh-comment-id:3050141029 --> @matze commented on GitHub (Jul 8, 2025): I won't bring back the option but rather extract that info from a `Forwarded` header.
Author
Owner

@MIvanchev commented on GitHub (Jul 8, 2025):

That'll be perfect, I'm really eager to use it, being and Rust and so simple and straightforward, great work.

<!-- gh-comment-id:3050157464 --> @MIvanchev commented on GitHub (Jul 8, 2025): That'll be perfect, I'm really eager to use it, being and Rust and so simple and straightforward, great work.
Author
Owner

@matze commented on GitHub (Jul 9, 2025):

I think this is not even necessary and it actually stems from using absolute paths in a lot of places. Are you able to test from source?

<!-- gh-comment-id:3052441645 --> @matze commented on GitHub (Jul 9, 2025): I think this is not even necessary and it actually stems from using absolute paths in a lot of places. Are you able to test from source?
Author
Owner

@MIvanchev commented on GitHub (Jul 9, 2025):

Sure, if necessary I'll do it.

<!-- gh-comment-id:3052658232 --> @MIvanchev commented on GitHub (Jul 9, 2025): Sure, if necessary I'll do it.
Author
Owner

@MIvanchev commented on GitHub (Jul 21, 2025):

Yeah, any news on this one, I really need a good paster :))

<!-- gh-comment-id:3096040913 --> @MIvanchev commented on GitHub (Jul 21, 2025): Yeah, any news on this one, I really need a good paster :))
Author
Owner

@ItIsSeven commented on GitHub (Aug 1, 2025):

Also facing this issue as I wanted to host on a different path behind Nginx

I imagine WASTEBIN_BASE_URL should apply for the JS/CSS files etc. to resolve this issue

<!-- gh-comment-id:3144974636 --> @ItIsSeven commented on GitHub (Aug 1, 2025): Also facing this issue as I wanted to host on a different path behind Nginx I imagine `WASTEBIN_BASE_URL` should apply for the JS/CSS files etc. to resolve this issue
Author
Owner

@MIvanchev commented on GitHub (Dec 28, 2025):

Hey @matze I was thinking about this again, isn't the problem solvable through a layer to the router? If you want we could look at it together.

<!-- gh-comment-id:3694651897 --> @MIvanchev commented on GitHub (Dec 28, 2025): Hey @matze I was thinking about this again, isn't the problem solvable through a layer to the router? If you want we could look at it together.
Author
Owner

@matze commented on GitHub (Dec 28, 2025):

The routes themselves are not the problem, I tried exactly what you propose. The problem are URLs that are used in the templates. I tried using relative URLs where possible and it helped to a degree but not always.

<!-- gh-comment-id:3695021120 --> @matze commented on GitHub (Dec 28, 2025): The routes themselves are not the problem, I tried exactly what you propose. The problem are URLs that are used in the templates. I tried using relative URLs where possible and it helped to a degree but not always.
Author
Owner

@MIvanchev commented on GitHub (Dec 29, 2025):

Would it help to modify them like this

<link rel="stylesheet" href="{{ page.assets.css.dark.href() }}">

and define the href property to be prefix + route() ?

<!-- gh-comment-id:3696015914 --> @MIvanchev commented on GitHub (Dec 29, 2025): Would it help to modify them like this `<link rel="stylesheet" href="{{ page.assets.css.dark.href() }}">` and define the `href` property to be `prefix + route()` ?
Author
Owner

@MIvanchev commented on GitHub (Dec 29, 2025):

@matze I'm modding the templates and adding some path prefix, code. Could you tell me what this element is doing and how it should be prefixed?

      <a href="../{{ key }}" class="nav-button" title="paste content" aria-label="paste content">
<!-- gh-comment-id:3697055953 --> @MIvanchev commented on GitHub (Dec 29, 2025): @matze I'm modding the templates and adding some path prefix, code. Could you tell me what this element is doing and how it should be prefixed? ``` <a href="../{{ key }}" class="nav-button" title="paste content" aria-label="paste content"> ```
Author
Owner

@MIvanchev commented on GitHub (Dec 30, 2025):

Hey @matze, I've added some code to support prefixing. The correct header is X-Forwarded-Prefix because Forwarded only carries host info. Let me know what you think.

<!-- gh-comment-id:3698948234 --> @MIvanchev commented on GitHub (Dec 30, 2025): Hey @matze, I've added some code to support prefixing. The correct header is `X-Forwarded-Prefix` because `Forwarded` only carries host info. Let me know what you think.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/wastebin-matze#108
No description provided.