[GH-ISSUE #695] 增加HTTP缓存 #546

Closed
opened 2026-05-05 12:21:18 -06:00 by gitea-mirror · 14 comments
Owner

Originally created by @boynicholas on GitHub (Apr 8, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/695

frp映射http应用时,js及css等静态资源可以在frps中进行缓存。下次再次请求,在URL链接没有变动的情况下,可以直接读取缓存返回给用户。减少等待时间。

Originally created by @boynicholas on GitHub (Apr 8, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/695 frp映射http应用时,js及css等静态资源可以在frps中进行缓存。下次再次请求,在URL链接没有变动的情况下,可以直接读取缓存返回给用户。减少等待时间。
gitea-mirror 2026-05-05 12:21:18 -06:00
  • closed this issue
  • added the
    no plan
    label
Author
Owner

@wxlg1117 commented on GitHub (Apr 9, 2018):

这类功能请找nginx吧

<!-- gh-comment-id:379607894 --> @wxlg1117 commented on GitHub (Apr 9, 2018): 这类功能请找nginx吧
Author
Owner

@fatedier commented on GitHub (Apr 9, 2018):

目前应该也有可行的替代方案,优先级不高。

<!-- gh-comment-id:379811259 --> @fatedier commented on GitHub (Apr 9, 2018): 目前应该也有可行的替代方案,优先级不高。
Author
Owner

@kavid commented on GitHub (Apr 15, 2018):

https://wenku.baidu.com/view/dac78d2349d7c1c708a1284ac850ad02de8007b9.html

可以参考这个

<!-- gh-comment-id:381372036 --> @kavid commented on GitHub (Apr 15, 2018): https://wenku.baidu.com/view/dac78d2349d7c1c708a1284ac850ad02de8007b9.html 可以参考这个
Author
Owner

@KagurazakaNyaa commented on GitHub (Apr 17, 2018):

那你这个万一服务器端的资源被更新了怎么办?
你不可能让服务器给frpc发个消息到frps说某个静态资源发生变更了吧,如果是用轮询方式又会有额外的开销,说不定这个开销比每次直接请求资源还要高。
如果你缓存的生命周期比较短,那性能也不会高多少,如果比较长,你就要面临我上面提到的问题。

<!-- gh-comment-id:382060306 --> @KagurazakaNyaa commented on GitHub (Apr 17, 2018): 那你这个万一服务器端的资源被更新了怎么办? 你不可能让服务器给frpc发个消息到frps说某个静态资源发生变更了吧,如果是用轮询方式又会有额外的开销,说不定这个开销比每次直接请求资源还要高。 如果你缓存的生命周期比较短,那性能也不会高多少,如果比较长,你就要面临我上面提到的问题。
Author
Owner

@kavid commented on GitHub (Apr 17, 2018):

静态资源发生改变通常都是手动的,你可以直接用nginx里的链接刷新功能即可。

<!-- gh-comment-id:382099593 --> @kavid commented on GitHub (Apr 17, 2018): 静态资源发生改变通常都是手动的,你可以直接用nginx里的链接刷新功能即可。
Author
Owner

@xiaoyell commented on GitHub (Apr 19, 2018):

我觉得这个功能挺好的啊

<!-- gh-comment-id:382638507 --> @xiaoyell commented on GitHub (Apr 19, 2018): 我觉得这个功能挺好的啊
Author
Owner

@boynicholas commented on GitHub (Apr 19, 2018):

如果使用Nginx进行缓存,由于粗粒度缓存,无法精准的针对项目进行缓存。有些项目是已经开发完成了的,资源文件较少有改动的情况下。是可以开启缓存的。如果项目正在开发中,关闭缓存。Nginx做不到针对于项目基本的缓存控制。所以建议在FRP层面增加缓存。由frpc配置文件中针对单个项目自行选择开启缓存还是关闭缓存。而不用在frps服务端的nginx中进行变更

<!-- gh-comment-id:382639811 --> @boynicholas commented on GitHub (Apr 19, 2018): 如果使用Nginx进行缓存,由于粗粒度缓存,无法精准的针对项目进行缓存。有些项目是已经开发完成了的,资源文件较少有改动的情况下。是可以开启缓存的。如果项目正在开发中,关闭缓存。Nginx做不到针对于项目基本的缓存控制。所以建议在FRP层面增加缓存。由frpc配置文件中针对单个项目自行选择开启缓存还是关闭缓存。而不用在frps服务端的nginx中进行变更
Author
Owner

@boynicholas commented on GitHub (Apr 19, 2018):

@XiLingHost 通过URL进行判断,如果URL未变动的情况下,获取服务端缓存。URL有变动则刷新缓存。Nginx,浏览器等缓存都是这样操作的。如果资源文件有变动的情况下,在资源地址后面增加参数即可,如:http://xxx.com/main.js?v=20180419这种方式

<!-- gh-comment-id:382640128 --> @boynicholas commented on GitHub (Apr 19, 2018): @XiLingHost 通过URL进行判断,如果URL未变动的情况下,获取服务端缓存。URL有变动则刷新缓存。Nginx,浏览器等缓存都是这样操作的。如果资源文件有变动的情况下,在资源地址后面增加参数即可,如:http://xxx.com/main.js?v=20180419这种方式。
Author
Owner

@linkerlin commented on GitHub (Apr 19, 2018):

没必要加这个功能,nginx前置做个代理即可.

On Thu, Apr 19, 2018 at 3:36 PM, 蓝雨麦浪 notifications@github.com wrote:

@XiLingHost https://github.com/XiLingHost 通过URL进行判断,如果URL未变动的情况下,
获取服务端缓存。URL有变动则刷新缓存。Nginx,浏览器等缓存都是这样操作的。


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/fatedier/frp/issues/695#issuecomment-382640128, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AACQxt-immgmU4uwGWCOJoRO0l7xJPVwks5tqD58gaJpZM4TLWjF
.

--

Regards,Linker Linlinker.m.lin@gmail.com linker.m.lin@gmail.com

<!-- gh-comment-id:382644793 --> @linkerlin commented on GitHub (Apr 19, 2018): 没必要加这个功能,nginx前置做个代理即可. On Thu, Apr 19, 2018 at 3:36 PM, 蓝雨麦浪 <notifications@github.com> wrote: > @XiLingHost <https://github.com/XiLingHost> 通过URL进行判断,如果URL未变动的情况下, > 获取服务端缓存。URL有变动则刷新缓存。Nginx,浏览器等缓存都是这样操作的。 > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/fatedier/frp/issues/695#issuecomment-382640128>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/AACQxt-immgmU4uwGWCOJoRO0l7xJPVwks5tqD58gaJpZM4TLWjF> > . > -- *Regards,Linker Linlinker.m.lin@gmail.com <linker.m.lin@gmail.com>*
Author
Owner

@fatedier commented on GitHub (Apr 19, 2018):

通常来说,需要做缓存的大多数是图片,建议还是结合 CDN 比较合适。加入这个功能会让这个项目比较重,短期内是没有计划,未来如果有简单合适的方式,也可以考虑。

<!-- gh-comment-id:382763938 --> @fatedier commented on GitHub (Apr 19, 2018): 通常来说,需要做缓存的大多数是图片,建议还是结合 CDN 比较合适。加入这个功能会让这个项目比较重,短期内是没有计划,未来如果有简单合适的方式,也可以考虑。
Author
Owner

@orangle commented on GitHub (Apr 24, 2018):

这是cache server的功能吧,用ats nginx等啊

<!-- gh-comment-id:383814021 --> @orangle commented on GitHub (Apr 24, 2018): 这是cache server的功能吧,用ats nginx等啊
Author
Owner

@kery commented on GitHub (May 28, 2018):

个人觉得 frp 的主要功能是穿透,不是做一个 HTTP 服务器,感觉这个功能没必要做。

<!-- gh-comment-id:392406586 --> @kery commented on GitHub (May 28, 2018): 个人觉得 frp 的主要功能是穿透,不是做一个 HTTP 服务器,感觉这个功能没必要做。
Author
Owner

@kinneyli commented on GitHub (Aug 20, 2018):

frp 不宜做缓存机制。

<!-- gh-comment-id:414251090 --> @kinneyli commented on GitHub (Aug 20, 2018): frp 不宜做缓存机制。
Author
Owner

@feng-yifan commented on GitHub (Aug 30, 2018):

你这个要求,干脆让作者将frp跟nginx的功能合并好了……

<!-- gh-comment-id:417355569 --> @feng-yifan commented on GitHub (Aug 30, 2018): 你这个要求,干脆让作者将frp跟nginx的功能合并好了……
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#546
No description provided.