DIYgod / DIYgod/RSSHub

Telegram media URLs wrong for instances behind a reverse proxy subpath

Open
#20,191 5 comments 3 reactions 0 assignees View on GitHub
RSS bug
Dominant language
TypeScript
Stars
46.2k
Forks
10.2k
Avg merge
8h 48m
Merged PRs (30d)
175

Description

### Routes

```routes
/telegram/channel/:username/:routeParams?
```

### Full routes

```fullroutes
/telegram/channel/awesomeRSSHub
```

### Related documentation

https://docs.rsshub.app/routes/popular#channel

### What is expected?

For an instance behind a reverse proxy subpath (e.g: `https://example.com/rss`) the media URLs should be `https://example.com/rss/telegram/media/awesomeRSSHub/1234`.

### What is actually happening?

The media URLs are `https://example.com/telegram/media/awesomeRSSHub/1234` (`/rss` is missing).

### Deployment information

Self-hosted

### Deployment information (for self-hosted)

_No response_

### Additional info

An environmental variable for the base URL could be used with [`new URL(ctx.req.url).origin`](https://github.com/DIYgod/RSSHub/blob/fff0cb0545f2e976eca9ed7dc5efe87f226dc289/lib/routes/telegram/tglib/channel.ts#L156C28-L156C55) as fallback.

### This is not a duplicated issue

- [x] I have searched [existing issues](https://github.com/DIYgod/RSSHub/issues) to ensure this bug has not already been reported

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.