Giter VIP home page Giter VIP logo

Comments (6)

kirillDanshin avatar kirillDanshin commented on June 14, 2024

@jonathan-kosgei Hi.

Actually, everything works as expected.

  1. if you call curl in verbose mode, you'll see redirect TSR:
curl -vvvvv 127.1:8080/joe/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.1 (127.0.0.1) port 8080 (#0)
> GET /joe/ HTTP/1.1
> Host: 127.1:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: fasthttp
< Date: Tue, 24 Sep 2019 17:27:28 GMT
< Content-Length: 0
< Location: http://127.1:8080/joe
<
* Connection #0 to host 127.1 left intact
  1. then, if you set -L flag to follow redirects, you'll see that your request is processed correctly:
curl -L -vvvvv 127.1:8080/joe/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.1 (127.0.0.1) port 8080 (#0)
> GET /joe/ HTTP/1.1
> Host: 127.1:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: fasthttp
< Date: Tue, 24 Sep 2019 17:28:13 GMT
< Content-Length: 0
< Location: http://127.1:8080/joe
<
* Connection #0 to host 127.1 left intact
* Issue another request to this URL: 'http://127.1:8080/joe'
* Found bundle for host 127.1: 0x7f89d7008360 [can pipeline]
* Re-using existing connection! (#0) with host 127.1
* Connected to 127.1 (127.0.0.1) port 8080 (#0)
> GET /joe HTTP/1.1
> Host: 127.1:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: fasthttp
< Date: Tue, 24 Sep 2019 17:28:13 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 7
<
Hi joe
* Connection #0 to host 127.1 left intact

from router.

jonathan-kosgei avatar jonathan-kosgei commented on June 14, 2024

You're right! My bad, thank you for explaining this.

from router.

jonathan-kosgei avatar jonathan-kosgei commented on June 14, 2024

Is there a way to handle this without a redirect?

from router.

savsgio avatar savsgio commented on June 14, 2024

Do you mean to process and send the correct response without redirection?

from router.

jonathan-kosgei avatar jonathan-kosgei commented on June 14, 2024

Yes, to match the route without a redirect, I'm building an developer-focused API so a lot of users will try out the service from their command lines and they will not know they need to setup following redirects with curl.

from router.

savsgio avatar savsgio commented on June 14, 2024

I'm sorry, but these is not the correct functioning, because the registered path is not the requested path. That's why redirection is done only when the difference is the trailing slash.

You could make the following redirect until end, and for the new requests go to the correct path, just like the browsers done (transparent to the user)

from router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.