guzba / mummy

An HTTP and WebSocket server for Nim that returns to the ancient ways of threads.
MIT License
281 stars 11 forks source link

Redirect to external site #121

Closed Spirarel closed 5 months ago

Spirarel commented 5 months ago

This could be my strong lack of FE knowledge. I'm playing around making a go-link/tinyURL style website. When I run a request.respond with a 3XX and Location header, I'm seeing the endpoint replaced in the browser, not a redirect to an external site. Is this something that you can do with the server alone or maybe a limitation of mummy?

Ex: go mapped to www.google.com localhost:8080/go -> localhost:8080/www.google.com

Instead of localhost:8080/go -> www.google.com

Spirarel commented 5 months ago

Never mind, I figured it out. Turns out for the Location header to redirect externally, you need to specify the scheme (e.g. http://). Otherwise, it's a local redirect.