Jump to content

What will do when client apps get 307 response code?


cielpy572
Go to solution Solved by Luke,

Recommended Posts

cielpy572

The wiki of HTTP 307 List of HTTP status codes - Wikipedia

 

When the user login, if a server returns a 307 response, do apps will post to the new location?

I tried with the iOS app will alert an error.

 

And try with curl command, with -L flag, it will post to the new location. Logs like this

 

curl -v -L 'https://home-emby.test.com/emby/Users/authenticatebyname?X-Emby-Client=Emby%20Web&X-Emby-Device-Name=Microsoft%20Edge%20macOS&X-Emby-Device-Id=995b8382-7974-45af-8ee9-62ef6cb47eb1&X-Emby-Client-Version=4.7.8.0'   -H 'accept: application/json'   -H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,zh-TW;q=0.5,pt;q=0.4'   -H 'cache-control: no-cache'   -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8'   -H 'origin: https://home-emby.test.com'   -H 'pragma: no-cache'   -H 'sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"'   -H 'sec-ch-ua-mobile: ?0'   -H 'sec-ch-ua-platform: "macOS"'   -H 'sec-fetch-dest: empty'   -H 'sec-fetch-mode: cors'   -H 'sec-fetch-site: same-origin'   -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50'   --data-raw 'Username=ciel&Pw=xx'   --compressed
*   Trying 45.32.113.xxx:443...
* Connected to home-emby.test.com (45.32.113.xxx) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=*.test.com
*  start date: Dec 30 01:17:52 2022 GMT
*  expire date: Mar 30 01:17:51 2023 GMT
*  subjectAltName: host "home-emby.test.com" matched cert's "*.test.com"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fbfb8813c00)
> POST /emby/Users/authenticatebyname?X-Emby-Client=Emby%20Web&X-Emby-Device-Name=Microsoft%20Edge%20macOS&X-Emby-Device-Id=995b8382-7974-45af-8ee9-62ef6cb47eb1&X-Emby-Client-Version=4.7.8.0 HTTP/2
> Host: home-emby.test.com
> accept-encoding: deflate, gzip, br, zstd
> accept: application/json
> accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,zh-TW;q=0.5,pt;q=0.4
> cache-control: no-cache
> content-type: application/x-www-form-urlencoded; charset=UTF-8
> origin: https://home-emby.test.com
> pragma: no-cache
> sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"
> sec-ch-ua-mobile: ?0
> sec-ch-ua-platform: "macOS"
> sec-fetch-dest: empty
> sec-fetch-mode: cors
> sec-fetch-site: same-origin
> user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50
> content-length: 31
>
* We are completely uploaded and fine
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 307
< server: nginx
< date: Sat, 25 Feb 2023 06:00:38 GMT
< content-type: text/html
< content-length: 164
< location: https://home-emby-entrance.test.com:3711/emby/Users/authenticatebyname?X-Emby-Client=Emby%20Web&X-Emby-Device-Name=Microsoft%20Edge%20macOS&X-Emby-Device-Id=995b8382-7974-45af-8ee9-62ef6cb47eb1&X-Emby-Client-Version=4.7.8.0
< strict-transport-security: max-age=31536000; includeSubdomains; preload
<
* Ignoring the response-body
* Connection #0 to host home-emby.test.com left intact
* Issue another request to this URL: 'https://home-emby-entrance.test.com:3711/emby/Users/authenticatebyname?X-Emby-Client=Emby%20Web&X-Emby-Device-Name=Microsoft%20Edge%20macOS&X-Emby-Device-Id=995b8382-7974-45af-8ee9-62ef6cb47eb1&X-Emby-Client-Version=4.7.8.0'
*   Trying 2xx8:xx56:686:xx::1:3711...
*   Trying 35.32.1.xx:3711...
* Connected to home-emby-entrance.test.com (35.32.1.xx) port 3711 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=test.com
*  start date: Feb 23 15:08:46 2023 GMT
*  expire date: May 24 15:08:45 2023 GMT
*  subjectAltName: host "home-emby-entrance.test.com" matched cert's "*.test.com"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fbfb8813c00)
> POST /emby/Users/authenticatebyname?X-Emby-Client=Emby%20Web&X-Emby-Device-Name=Microsoft%20Edge%20macOS&X-Emby-Device-Id=995b8382-7974-45af-8ee9-62ef6cb47eb1&X-Emby-Client-Version=4.7.8.0 HTTP/2
> Host: home-emby-entrance.test.com:3711
> accept-encoding: deflate, gzip, br, zstd
> accept: application/json
> accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,zh-TW;q=0.5,pt;q=0.4
> cache-control: no-cache
> content-type: application/x-www-form-urlencoded; charset=UTF-8
> origin: https://home-emby.test.com
> pragma: no-cache
> sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"
> sec-ch-ua-mobile: ?0
> sec-ch-ua-platform: "macOS"
> sec-fetch-dest: empty
> sec-fetch-mode: cors
> sec-fetch-site: same-origin
> user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50
> content-length: 31
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
* We are completely uploaded and fine
< HTTP/2 200
< server: nginx
< date: Sat, 25 Feb 2023 06:00:39 GMT
< content-type: application/json; charset=utf-8
< content-length: 1712
< access-control-allow-headers: Accept, Accept-Language, Authorization, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, Content-Type, Date, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, Want-Digest, X-MediaBrowser-Token, X-Emby-Token, X-Emby-Client, X-Emby-Client-Version, X-Emby-Device-Id, X-Emby-Device-Name, X-Emby-Authorization
< access-control-allow-methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
< access-control-allow-origin: *
< content-encoding: br
< expires: -1
< vary: Accept-Encoding
< access-control-allow-private-network: true
<
* Connection #1 to host home-emby-entrance.test.com left intact
{"User":{"Name":"ciel","ServerId":"631806e7e5114bb3"...}%                                            

 

I thinks if apps work like curl, it will login success, but for now it's not, could apps work like curl?

 

I want this redirect to work because I want to access the server with a public IPv4 IP,  but my network is behind a NAT, and I can get the port after NAT, so I need a server to redirect to the dynamic port.

Edited by cielpy572
Link to comment
Share on other sites

cielpy572
6 hours ago, Luke said:

Hi, why not just enter the ipv4 address to begin with?

Because I do not have a static IPv4 address, the port and the IPv4 address are both dynamic, so I want to use a program run on a server that has a static IPv4 address to redirect to the dynamic address and port. I can tell the server which address should redirect to.

Link to comment
Share on other sites

The problem is we don’t always have control over the network layers of the different platforms so that’s why your best bet is figuring out a static ipv4 or using a ddns.

Link to comment
Share on other sites

  • 2 weeks later...
cielpy572

DDNS can get only the latest IP, not the port, static IP is enough for all usage, but it's difficult to get for personal user, it's expensive and always for commercial use.

For users whose emby server running at home, only having a carrier NAT IP is normal, so please consider support HTTP 307 or SRV DNS record, it will very helpful.

Or does emby premium provide some method to get the latest server address when login in with an emby account? I can pay for it.

Link to comment
Share on other sites

On 3/7/2023 at 2:38 AM, cielpy572 said:

DDNS can get only the latest IP, not the port, static IP is enough for all usage, but it's difficult to get for personal user, it's expensive and always for commercial use.

For users whose emby server running at home, only having a carrier NAT IP is normal, so please consider support HTTP 307 or SRV DNS record, it will very helpful.

Or does emby premium provide some method to get the latest server address when login in with an emby account? I can pay for it.

Emby Connect acts like a ddns in a way. It does not require Emby Premiere.

Link to comment
Share on other sites

cielpy572

Thanks! I have tried Emby Connect, it works well when the port and domain do not change, it's a perfect solution.

But when the remote address changes, like port or domain, what will happen to the user who login with Emby Connect and chooses a server with the old address?

For my test, the user will load a very long time and then forced be logout, can Emby clients get the latest address and connect to it?

 

And the other question is if I change the remove https port configuration, do I need to restart the server? It seems like the remote address only reports to the server when Emby server is up, not when the configuration changes.

Edited by cielpy572
Link to comment
Share on other sites

  • Solution

The server reports the new address to our Emby Connect service right away when you change the config, but the apps don't respond in realtime to that. If they're in the middle of being used, then yes they'll have to go through a timeout and then reconnect.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...