只要我使用代理,HTML中的更改就不会反映出来

时间:2022-09-04 08:17:59

I shifted from Eclipse to Jdeveloper. I had a weird problem that I was able to solve but not able to understand.

我从Eclipse转到了Jdeveloper。我有一个奇怪的问题,我能够解决,但无法理解。

Whenever I made any changes in HTML in Jdeveloper's web projects the changes were not reflected when I ran the HTML again. The old webpages kept coming in the webbrowser. Same source code. Same CSS/JS. I found that as long as there were proxy settings in my web browser the changes were not reflected. But if I switched off the proxy the changes made in HTML were reflected i.e webpage were displayed with the changes made from last time.

每当我在Jdeveloper的Web项目中对HTML进行任何更改时,我再次运行HTML时都没有反映出这些更改。旧的网页不断进入网络浏览器。相同的源代码。相同的CSS / JS。我发现只要我的网络浏览器中有代理设置,就不会反映出这些变化。但是,如果我关闭代理,则会反映出HTML中所做的更改,即显示的网页显示了上次更改。

By proxy set I mean proxy setting placed at the following Window -> Start Menu -> internet options -> Connections -> LAN Settings -> Proxy Server

通过代理集我的意思是代理设置放在以下窗口 - >开始菜单 - >互联网选项 - >连接 - >局域网设置 - >代理服务器

I have tried to run the resulting URL on Google chrome, Firefox and internet explorer. As long as the web browser was using proxy the changes made in HTML were not shown by running it again.

我试图在Google Chrome,Firefox和Internet Explorer上运行生成的URL。只要Web浏览器使用代理,通过再次运行它就不会显示HTML中所做的更改。

In Eclipse Juno I simply had to clean Tomcat's directory to get changes reflected.

在Eclipse Juno中,我只需清理Tomcat的目录以反映更改。

Anyone can explain why this happens?

有谁能解释为什么会这样?

2 个解决方案

#1


5  

Web servers return HTTP headers with every response, and usually those headers specify how long the response can be cached for. Proxy servers read those headers and make a decision whenever they see the same request again -- whether to propagate that request to the server again, or to simply return the cached copy of the response.

Web服务器返回每个响应的HTTP标头,通常这些标头指定可以缓存响应的时间。代理服务器读取这些头并在他们再次看到相同请求时做出决定 - 是否再次将该请求传播到服务器,或者只是返回响应的缓存副本。

You can modify your server's configuration so that it the next time it tells the proxy server not to cache pages. However, some proxy servers are mis-configured or broken, and will cache pages that they are not supposed to cache.

您可以修改服务器的配置,以便下次它告诉代理服务器不要缓存页面。但是,某些代理服务器配置错误或损坏,并将缓存它们不应缓存的页面。

For those cases, one ugly solution that works is to give your JS and CSS files new names whenever you change them. For example, if your index.html file includes index.css and index.js, and you make a change to index.js, you can save the changed file as index.2.js and change the tag in your index.html file to point to index.2.js from now on.

对于这些情况,一个丑陋的解决方案是在您更改它们时为您的JS和CSS文件提供新名称。例如,如果您的index.html文件包含index.css和index.js,并且您对index.js进行了更改,则可以将更改的文件另存为index.2.js并更改index.html文件中的标记从现在开始指向index.2.js。

That's a bit drastic, but it works. A simpler solution to start with is to refresh your page using Shift-F5 rather than just F5 (in your browser). That tells the browser to force a refresh of all cached pages, whenever possible.

这有点激烈,但它确实有效。一个更简单的解决方案是使用Shift-F5而不是F5(在浏览器中)刷新页面。这告诉浏览器尽可能强制刷新所有缓存的页面。

#2


3  

This seems tied to your proxy server type. There are several proxy server types, one of which is a "Caching Proxy Server". Which, if many users are connected to it, allows static pages to be stored locally on the server for repetitive requests from the client(you). When you change the proxy it is most likely just sending you an updated copy due to not having you as an active client, or being that you are a new user.

这似乎与您的代理服务器类型有关。有几种代理服务器类型,其中一种是“高速缓存代理服务器”。如果许多用户连接到它,则允许静态页面本地存储在服务器上,以便客户(您)重复请求。当您更改代理时,由于没有您作为活动客户端,或者您是新用户,因此很可能只是向您发送更新的副本。

I would assume that the content on the new software you are building is precaching saved page names where as Eclipse Juno is was generating real time screens on the fly, bypassing the cached server option.

我假设您正在构建的新软件上的内容正在预先保存已保存的页面名称,而Eclipse Juno正在动态生成实时屏幕,绕过缓存的服务器选项。

#1


5  

Web servers return HTTP headers with every response, and usually those headers specify how long the response can be cached for. Proxy servers read those headers and make a decision whenever they see the same request again -- whether to propagate that request to the server again, or to simply return the cached copy of the response.

Web服务器返回每个响应的HTTP标头,通常这些标头指定可以缓存响应的时间。代理服务器读取这些头并在他们再次看到相同请求时做出决定 - 是否再次将该请求传播到服务器,或者只是返回响应的缓存副本。

You can modify your server's configuration so that it the next time it tells the proxy server not to cache pages. However, some proxy servers are mis-configured or broken, and will cache pages that they are not supposed to cache.

您可以修改服务器的配置,以便下次它告诉代理服务器不要缓存页面。但是,某些代理服务器配置错误或损坏,并将缓存它们不应缓存的页面。

For those cases, one ugly solution that works is to give your JS and CSS files new names whenever you change them. For example, if your index.html file includes index.css and index.js, and you make a change to index.js, you can save the changed file as index.2.js and change the tag in your index.html file to point to index.2.js from now on.

对于这些情况,一个丑陋的解决方案是在您更改它们时为您的JS和CSS文件提供新名称。例如,如果您的index.html文件包含index.css和index.js,并且您对index.js进行了更改,则可以将更改的文件另存为index.2.js并更改index.html文件中的标记从现在开始指向index.2.js。

That's a bit drastic, but it works. A simpler solution to start with is to refresh your page using Shift-F5 rather than just F5 (in your browser). That tells the browser to force a refresh of all cached pages, whenever possible.

这有点激烈,但它确实有效。一个更简单的解决方案是使用Shift-F5而不是F5(在浏览器中)刷新页面。这告诉浏览器尽可能强制刷新所有缓存的页面。

#2


3  

This seems tied to your proxy server type. There are several proxy server types, one of which is a "Caching Proxy Server". Which, if many users are connected to it, allows static pages to be stored locally on the server for repetitive requests from the client(you). When you change the proxy it is most likely just sending you an updated copy due to not having you as an active client, or being that you are a new user.

这似乎与您的代理服务器类型有关。有几种代理服务器类型,其中一种是“高速缓存代理服务器”。如果许多用户连接到它,则允许静态页面本地存储在服务器上,以便客户(您)重复请求。当您更改代理时,由于没有您作为活动客户端,或者您是新用户,因此很可能只是向您发送更新的副本。

I would assume that the content on the new software you are building is precaching saved page names where as Eclipse Juno is was generating real time screens on the fly, bypassing the cached server option.

我假设您正在构建的新软件上的内容正在预先保存已保存的页面名称,而Eclipse Juno正在动态生成实时屏幕,绕过缓存的服务器选项。