Git Product home page Git Product logo

Comments (9)

wushiwe-beep avatar wushiwe-beep commented on August 24, 2024 1

如果部署后没办法登录的原因是因为nginx导致的两次cookie不同。
我这边用的是nginx部署的,最后是修改了这部分就成功了
location /api {
proxy_pass http://localhost:8102/api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cookie_path / /;
proxy_set_header Cookie $http_cookie;
proxy_cookie_flags ~ nosecure samesite=strict; }

from sql-father-backend-public.

lvhaosir6 avatar lvhaosir6 commented on August 24, 2024

表示部署在同一台都失效了,但是在本机启动时可以。

from sql-father-backend-public.

heyi-byte avatar heyi-byte commented on August 24, 2024

有结果了吗

from sql-father-backend-public.

a870368162 avatar a870368162 commented on August 24, 2024

有没有可能是与谷歌浏览器不兼容,换个浏览器试试

from sql-father-backend-public.

AIpolaris avatar AIpolaris commented on August 24, 2024

如果部署后没办法登录的原因是因为nginx导致的两次cookie不同。 我这边用的是nginx部署的,最后是修改了这部分就成功了 location /api { proxy_pass http://localhost:8102/api; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-PORT $remote_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_cookie_path / /; proxy_set_header Cookie $http_cookie; proxy_cookie_flags ~ nosecure samesite=strict; }

使用此方法解决部署时不能登录的问题

from sql-father-backend-public.

a877429929 avatar a877429929 commented on August 24, 2024

还是不行

from sql-father-backend-public.

AIpolaris avatar AIpolaris commented on August 24, 2024

还是不行

如果是使用了nginx的话可以参考一下上面nginx的配置,我这边使用了之后可以解决了

from sql-father-backend-public.

thxcn avatar thxcn commented on August 24, 2024

我用这个方法也不行。不知道怎样设置,我看请求标头上并没有cookie,但是通过IDEA运行是有的

from sql-father-backend-public.

edanhuang avatar edanhuang commented on August 24, 2024

那是因为你前端调后端接口的URI前缀不一样导致的,需要在后端的配置文件里加上你nginx配置的后端接口前缀:

server:
  address: 0.0.0.0
  port: 8102
  servlet:
    context-path: /api  # here
    # session 30 天过期
    session:
      timeout: "P30D"
      cookie:
        same-site: none
        secure: true

from sql-father-backend-public.

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.