# Redirect 301 not working on a local server

**URL:** <https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336>\
**Category:** Bug report\
**Created:** [August 31, 2022, 12:39pm UTC](https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336 "2022-08-31T12:39:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fiatjaf](https://forum.antennapod.org/user_avatar/forum.antennapod.org/fiatjaf/32/1418_2.png) [@fiatjaf](https://forum.antennapod.org/u/fiatjaf)\
**Post date:** [August 31, 2022, 12:39pm UTC](https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336/1 "2022-08-31T12:39:06Z")

</div>

**App version** : 2.5.2 (1bc02fd84) from F-Droid

**Android version** : 8.0.0

**Device model** : ASUS X00RD

**Current behaviour** : A feed that issues a 301 Redirect should have its URL updated locally.

**First occurred** : Now

**Steps to reproduce** :

1. Write this code in a `main.go` file and run it with `go run main.go`

```auto
package main

import "net/http"

func main() {
    http.HandleFunc("/", handle)
    http.ListenAndServe(":44844", nil)
}

func handle(w http.ResponseWriter, r *http.Request) {
    http.Redirect(w, r, "https://corecursive.libsyn.com/feed", 301)
}

```

1. Add your local feed LAN URL to AntennaPod manually and subscribe to it.
2. It will load the feed from [corecursive.libsyn.com](http://corecursive.libsyn.com) etc.
3. Edit the Go file to use a different RSS feed URL in the redirect and restart the server.
4. Refresh the feed manually on AntennaPod.

The URL will not change in the AntennaPod podcast info, it will keep showing `http://localurl:localport`, and whenever you change the URL on the server it will keep redirecting to a new feed.

**Expected behaviour** :  
AntennaPod should forget the local LAN URL and assume the URL of the first feed to which it was redirected to as the actual concrete feed URL.

---

<div class="post-metadata">

**Author:** ![terminalmage](https://forum.antennapod.org/user_avatar/forum.antennapod.org/terminalmage/32/1364_2.png) [@terminalmage](https://forum.antennapod.org/u/terminalmage)\
**Post date:** [August 31, 2022, 1:03pm UTC](https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336/2 "2022-08-31T13:03:17Z")

</div>

A web browser doesn’t have this behavior, it simply follows the URL in the `Location` header. I’m not sure why AntennaPod should be expected to deviate from this behavior.

---

<div class="post-metadata">

**Author:** ![ByteHamster](https://forum.antennapod.org/user_avatar/forum.antennapod.org/bytehamster/32/4041_2.png) [@ByteHamster](https://forum.antennapod.org/u/ByteHamster)\
**Post date:** [August 31, 2022, 3:53pm UTC](https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336/3 "2022-08-31T15:53:56Z")

</div>

> [@terminalmage](#):
>
> ’m not sure why AntennaPod should be expected to deviate from this behavior.

AntennaPod does update the feed URLs on (permanent, not temporary) redirects to ensure that when the old URL is deleted, users still receive episodes.

> [@fiatjaf](#):
>
> **App version** : 2.5.2 (1bc02fd84) from F-Droid

Does updating help? We are at 2.6 already, and 2.7 is currently starting to roll out.

> [@fiatjaf](#):
>
> Write this code in a `main.go` file and run it with `go run main.go`

To me, this sounds like something is wrong with your go code and not with AntennaPod. I don’t know go and don’t have a development environment set up, so it is hard to confirm. Could you somehow host this on a publicly accessible server?

For testing, I usually use this feed: `https://tools.bytehamster.com/podcast/redirect.php`. It redirects to a new feed address every 5 seconds (containing a different timestamp in the end of the URL).

---

<div class="post-metadata">

**Author:** ![terminalmage](https://forum.antennapod.org/user_avatar/forum.antennapod.org/terminalmage/32/1364_2.png) [@terminalmage](https://forum.antennapod.org/u/terminalmage)\
**Post date:** [August 31, 2022, 7:00pm UTC](https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336/4 "2022-08-31T19:00:47Z")

</div>

@ByteHamster Very interesting, thanks!

---

<div class="post-metadata">

**Author:** ![fiatjaf](https://forum.antennapod.org/user_avatar/forum.antennapod.org/fiatjaf/32/1418_2.png) [@fiatjaf](https://forum.antennapod.org/u/fiatjaf)\
**Post date:** [September 9, 2022, 9:52am UTC](https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336/5 "2022-09-09T09:52:54Z")

</div>

Using this URL it did work as expected. Thank you!

But I can’t find anything that might be wrong with my setup. Could it be that my setup is using a local `http` (not `https`) URL?

If I learn anything more I’ll report back.

---

<div class="post-metadata">

**Author:** ![ByteHamster](https://forum.antennapod.org/user_avatar/forum.antennapod.org/bytehamster/32/4041_2.png) [@ByteHamster](https://forum.antennapod.org/u/ByteHamster)\
**Post date:** [September 9, 2022, 7:11pm UTC](https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336/6 "2022-09-09T19:11:34Z")

</div>

> [@fiatjaf](#):
>
> But I can’t find anything that might be wrong with my setup.

I don’t know. Maybe `curl -I` could help.

---

<div class="post-metadata">

**Author:** ![system](https://forum.antennapod.org/uploads/default/original/2X/3/3c7b7383b59ca5ff7c2c145444e45bd1436aa6c1.png) [@system](https://forum.antennapod.org/u/system)\
**Post date:** [January 7, 2023, 7:12pm UTC](https://forum.antennapod.org/t/redirect-301-not-working-on-a-local-server/2336/7 "2023-01-07T19:12:22Z")

</div>

Closed on January 7, 2023, 7:12pm UTC

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.
