Codeberg/pages-server
26
387
Fork
You've already forked pages-server
54

_redirects file not working? #234

Closed
opened 2023年07月19日 21:48:31 +02:00 by Andre601 · 15 comments

I've added a _redirects file to my pages repository containing the following content:

/AdvancedServerList/* https://docs.andre601.ch/AdvancedServerList/:splat
/Discord-Links https://docs.andre601.ch/Discord-Links
/GitHub-Markdown https://docs.andre601.ch/GitHub-Markdown
/Expansion-Wiki-Generator https://papi.andre601.ch

Yet, no matter which of the paths I access, the redirects do not happen at all. No matter if it is the one with a splat or those with a static path...

The domains themself do exist and resolve to actual sites, so this seems to be an issue with Codeberg pages.

Is there a delay until redirects become active? I've waited 15 minutes so far and no change happened. Also removed any cookies and cached data in case those could be the issue.

I've added a `_redirects` file to my `pages` repository containing the following content: ``` /AdvancedServerList/* https://docs.andre601.ch/AdvancedServerList/:splat /Discord-Links https://docs.andre601.ch/Discord-Links /GitHub-Markdown https://docs.andre601.ch/GitHub-Markdown /Expansion-Wiki-Generator https://papi.andre601.ch ``` Yet, no matter which of the paths I access, the redirects do not happen at all. No matter if it is the one with a splat or those with a static path... The domains themself do exist and resolve to actual sites, so this seems to be an issue with Codeberg pages. Is there a delay until redirects become active? I've waited 15 minutes so far and no change happened. Also removed any cookies and cached data in case those could be the issue.

As far as I'm aware codeberg.page hasn't yet deployed the version which has the redirect implementation. CC @6543

As far as I'm aware codeberg.page hasn't yet deployed the version which has the redirect implementation. CC @6543

That's strange given the docs already mention it, so if that's true, then the docs may need to pull that page to stop people from being mislead...

Although, in such a case would I now shamelessly point to my issue #232 which suggests a .pages file to be used for multiple new features, including the move of _redirects to it as a dedicated option...
May be a good idea (if technically possible of course) to maybe consider this before deploying the _redirects file support.


EDIT

I for now added a Cloudflare redirect rule for the /AdvancedServerList/* paths.
So if you want to test if it works or not, use one of the other entries as the above won't be a reliable source to test.

That's strange given the docs already mention it, so if that's true, then the docs may need to pull that page to stop people from being mislead... Although, in such a case would I now shamelessly point to my issue #232 which suggests a `.pages` file to be used for multiple new features, including the move of `_redirects` to it as a dedicated option... May be a good idea (if technically possible of course) to maybe consider this before deploying the `_redirects` file support. --- EDIT I for now added a Cloudflare redirect rule for the `/AdvancedServerList/*` paths. So if you want to test if it works or not, use one of the other entries as the above won't be a reliable source to test.

I've just checked, production is running ce241fa40a, which didn't yet include the redirect code. @6543 I think it might be time for a new release, because apparently the documentation was already updated.

I've just checked, production is running https://codeberg.org/Codeberg/pages-server/commit/ce241fa40adee2b12f8e225db98e09a45bc2acbb, which didn't yet include the redirect code. @6543 I think it might be time for a new release, because apparently [the documentation](https://docs.codeberg.org/codeberg-pages/redirects/) was already updated.

Although, in such a case would I now shamelessly point to my issue #232 which suggests a .pages file to be used for multiple new features, including the move of _redirects to it as a dedicated option...
May be a good idea (if technically possible of course) to maybe consider this before deploying the _redirects file support.

That would include quite a lot more code and thought before it can actually be implemented.

> Although, in such a case would I now shamelessly point to my issue #232 which suggests a .pages file to be used for multiple new features, including the move of _redirects to it as a dedicated option... May be a good idea (if technically possible of course) to maybe consider this before deploying the _redirects file support. That would include quite a lot more code and thought before it can actually be implemented.

That would include quite a lot more code and thought before it can actually be implemented.

Most likely yeah. Tho then the _redirects feature could be properly delayed with notes on the docs instead of pushing it now only to later be scrapped (if that would be the case, which I honestly would encourage as a single file would reduce extra configuration management for end users).

Currently considering to push a PR to docs repo to add a note about the redirect status (Not yet being implemented in production of Codeberg Pages), tho I first ask here...

Not sure how long the process of making a release would take here and if that note would be worth it.

> That would include quite a lot more code and thought before it can actually be implemented. Most likely yeah. Tho then the `_redirects` feature could be properly delayed with notes on the docs instead of pushing it now only to later be scrapped (if that would be the case, which I honestly would encourage as a single file would reduce extra configuration management for end users). Currently considering to push a PR to docs repo to add a note about the redirect status (Not yet being implemented in production of Codeberg Pages), tho I first ask here... Not sure how long the process of making a release would take here and if that note would be worth it.

One point to consider is that the _redirects file is also supported by some other static site hosting platforms and as such would allow automatic compatibility for redirects with other servers.
I know of following hosts that support it:

  • IPFS (the kubo implementation at least claims to support it)
  • cloudflare
One point to consider is that the `_redirects` file is also supported by some other static site hosting platforms and as such would allow automatic compatibility for redirects with other servers. I know of following hosts that support it: - IPFS (the kubo implementation at least claims to support it) - cloudflare

Currently considering to push a PR to docs repo to add a note about the redirect status (Not yet being implemented in production of Codeberg Pages), tho I first ask here...

Feel free to create such PR.

> Currently considering to push a PR to docs repo to add a note about the redirect status (Not yet being implemented in production of Codeberg Pages), tho I first ask here... Feel free to create such PR.

I really hope that an update will be made eventually, as I really need it.

Cannot use redirect rules for Cloudflare due to not proxying the DNS entries and I also don't want to make countless pages that perform a redirect...

I really hope that an update will be made eventually, as I really need it. Cannot use redirect rules for Cloudflare due to not proxying the DNS entries and I also don't want to make countless pages that perform a redirect...
Contributor
Copy link

Any updates?

Any updates?

The core redirection logic has been revised as part of #240 and unit tests are passing, but it will take a bit of time until all things are sorted out and ready to merge.

The core redirection logic has been revised as part of https://codeberg.org/Codeberg/pages-server/issues/240 and unit tests are passing, but it will take a bit of time until all things are sorted out and ready to merge.

deployed

deployed

@crapStone What has been deployed?

@crapStone What has been deployed?

the redirects feature was implemented a long time ago but no one created a release so Codeberg was running an old version of the pages-server

the redirects feature was implemented a long time ago but no one created a release so Codeberg was running an old version of the pages-server

deployed

Awesome. Thanks!

> deployed Awesome. Thanks!

Hmm... I noticed an interesting behaviour...

I have /AdvancedServerList/* https://docs.andre601.ch/AdvancedServerList/:splat defined.

But the redirect mixes up slashes it seems...

If I f.e. access https://andre601.ch/AdvancedServerList/commands/ will this redirect to https://docs.andre601.ch/AdvancedServerList//commands
The page loads... But the double slash is weird... I assume I remove the / before the :splash

Hmm... I noticed an interesting behaviour... I have `/AdvancedServerList/* https://docs.andre601.ch/AdvancedServerList/:splat` defined. But the redirect mixes up slashes it seems... If I f.e. access `https://andre601.ch/AdvancedServerList/commands/` will this redirect to `https://docs.andre601.ch/AdvancedServerList//commands` The page loads... But the double slash is weird... I assume I remove the `/` before the `:splash`
Sign in to join this conversation.
No Branch/Tag specified
main
no-not-allow-for-new-users
pages
pages-custom-domain-update
ci_user-local-acme-service
feat/redis-caching
fix/memory-problem
v6.4
v6.3
v6.2.1
v6.2
v6.1
v6.0
v5.1
v5.0
v4.6.3
v4.6.2
v4.6.1
v4.6
v4.5
v4.4
v4.3
v4.2
v4.1
v4.0
v3.2.1
v3.2
v0.3.1
v0.3.0
v0.2.2
v0.2.1
v3.1
v3.0a
v3.0
v2.5b
v2.5a
v2.5
v2.4
v2.3
v2.2
v2.1
v2.0
v1.0_php
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
6 participants
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
Codeberg/pages-server#234
Reference in a new issue
Codeberg/pages-server
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?