Code Monkey home page Code Monkey logo

Comments (4)

alexellis avatar alexellis commented on May 31, 2024 1

Hi @pyramation thanks for your help with this πŸ‘

The feature/fix is release and generally available.

Alex

from of-watchdog.

alexellis avatar alexellis commented on May 31, 2024

Example to reproduce the behaviour:

"use strict"

module.exports = (event, context) => {
  context
    .headers({'Location': 'https://www.google.com/'})
    .status(307)    // Temporary
    .succeed('Page has moved.')
}

With the Node template.

The Golang code in of-watchdog proxies up the Node HTTP process which tells it to redirect to i.e. google.com - so that's what the proxy does, it fetches the site Node is telling it to fetch.

That's why you're seeing this.

I'd be curious to see what happens if you try using a "stateless microservice" with OpenFaaS - i.e. your own Dockerfile + Node / Express server - https://www.openfaas.com/blog/stateless-microservices/

from of-watchdog.

alexellis avatar alexellis commented on May 31, 2024

We'd have to update the Golang proxying code to support this.

This is how I did it for the auth service in OpenFaaS Cloud - I needed the router to pass back the redirect instruction to the client’s browser. https://github.com/openfaas/openfaas-cloud/blob/3d3ed09707817b436751b279973d6f26191930a4/router/main.go#L34

cc @LucasRoesler

from of-watchdog.

pyramation avatar pyramation commented on May 31, 2024

I just added an example repo with a bare microservice (as @alexellis suggested) here https://github.com/pyramation/redirect-openfaas-example

screen shot 2018-10-16 at 10 59 22 am

Here are my results:

My first route (just a text response) is A-OK:

screen shot 2018-10-16 at 10 57 09 am
screen shot 2018-10-16 at 10 57 17 am

The redirect route, seems to work in sinatra, but not the browser:

screen shot 2018-10-16 at 10 59 15 am
screen shot 2018-10-16 at 10 59 04 am

from of-watchdog.

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.