• 请不要在回答技术问题时复制粘贴 AI 生成的内容
heyjianjun
V2EX  ›  程序员

内外网请求跨域问题

  •  
  •   heyjianjun · Sep 30, 2022 · 3657 views
    This topic created in 1496 days ago, the information mentioned may be changed or developed.

    我们公司用的是致远的 OA 系统,用域名访问,在公司默认走公司内网,回到家之后走外网,有的时候在公司打开正常,回到家之后就打不开,F12 看了下发现是跨域,明明网址和 css 、js 这些静态资源在一个域名下呀,仔细看了下请求的是缓存,清理下缓存就好了,有大佬遇到这种问题吗

    13 replies  •  2022-09-30 18:43:58 +08:00
    sunny1688
    sunny1688
    Sep 30, 2022
    1
    url 发来看看?
    tutou
    tutou
    Sep 30, 2022
    2
    建议说的详细点
    weixd96
    weixd96
    Sep 30, 2022
    3
    你们内网有 DNS 服务器吧
    crystom
    crystom
    Sep 30, 2022
    4
    对,我也遇到过,刷新缓存就正常了。明明资源跟网页 URL 在一个域的
    v2eb
    v2eb
    Sep 30, 2022 via Android
    5
    检查下 options 请求
    hua123s
    hua123s
    Sep 30, 2022 via iPhone
    6
    Vary: Origin
    @crystom 感觉你们说的和这个 header 有关
    crystom
    crystom
    Sep 30, 2022
    7
    @hua123s 是的,不过我的系统的 js ,css 一般只在本系统使用。中间确实切换过 ip ,比如断开和链接猥皮恩
    NewYear
    NewYear
    Sep 30, 2022
    8
    我家也用致远 OA ,统一用外网 IP 和端口就可以了。

    如果你家的外网 IP 和端口不能在内网访问,那你们的 IT 部门要打屁股。
    Daiwf
    Daiwf
    Sep 30, 2022
    9
    options 里面可能会去确认下 cookie 然后你刷了缓存 cookie 就对的上了,否则对不上。我猜的
    heyjianjun
    heyjianjun
    OP
    Sep 30, 2022
    10
    @weixd96 是的
    heyjianjun
    heyjianjun
    OP
    Sep 30, 2022
    11
    @NewYear 对,我查了下就是这个问题
    mylara
    mylara
    Sep 30, 2022
    12
    都用外网域名和端口访问就好了
    AnnatarHe
    AnnatarHe
    Sep 30, 2022
    13
    新策略。

    这篇文章讲的挺好: https://blog.conardli.top/2022/01/10/web/private-network/
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5258 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 72ms · UTC 02:23 · PVG 10:23 · LAX 18:23 · JFK 21:23
    ♥ Do have faith in what you're doing.