Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to write my cookie to the browser? #89

Closed
Michael2008S opened this issue Feb 19, 2019 · 3 comments
Closed

how to write my cookie to the browser? #89

Michael2008S opened this issue Feb 19, 2019 · 3 comments
Labels

Comments

@Michael2008S
Copy link

I try to set my cookie in my backend side with echo framework code :

func (s *Auth) SetLoginCookie(c echo.Context, path, actoken, rftoken string) {
	// 写入 cookie
	cookie := new(http.Cookie)
	cookie.Name = access_token
	cookie.Value = actoken
	cookie.Secure = true
	cookie.HttpOnly = true
	cookie.Path = path
	cookie.Domain = s.cfgCookies.Domain
	cookie.Expires = time.Now().Add(24 * time.Hour)
	fmt.Println("cookie:", cookie)
	c.SetCookie(cookie)
}

with the krakend config :

    {
      "endpoint": "/gcapi/iam.IAM/login",
      "method": "POST",
      "output_encoding": "JSON",
      "backend": [{
        "url_pattern": "/gcapi/iam.IAM/login",
        "encoding": "JSON",
        "disable_host_sanitize":true, 
        "sd": "etcd",
        "host": [
          "micro-rpc-iam"
        ]
      }]
    },

But I can't set the cookie in the chrome browser.

When I use the nginx to proxy the backend ,I can write it to my chrome browser.

How to set krakend Config to write the cookie ??

@kpacha
Copy link
Member

kpacha commented Feb 19, 2019

hi, @Michael2008S

the regular pipes drop every header included into the backend response(s)

If you are not using any other feature (merging, duplicated concurrent requests, encoding, etc), you can use the no-op proxy, so the requests and responses will be proxied as received.

@Michael2008S
Copy link
Author

@kpacha It work ,thanks.

@github-actions
Copy link

github-actions bot commented Apr 9, 2022

This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.

@github-actions github-actions bot added the locked label Apr 9, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants