GVKun编程网logo

使用jax-ws调用位于负载均衡器上的Web服务会返回http状态302,但是当我使用SoapUI时,它可以正常工作

16

此处将为大家介绍关于使用jax-ws调用位于负载均衡器上的Web服务会返回http状态302,但是当我使用SoapUI时,它可以正常工作的详细内容,此外,我们还将为您介绍关于ApacheWeb服务器不

此处将为大家介绍关于使用jax-ws调用位于负载均衡器上的Web服务会返回http状态302,但是当我使用SoapUI时,它可以正常工作的详细内容,此外,我们还将为您介绍关于Apache Web服务器不允许我在/ about上刷新,但在localhost上可以正常工作、asp.net – 如果内容是静态的,那么对于带有“If-Modified-Since”的请求,总是返回http状态304是否可以、AWS EC2:当我访问网站的 / 时,它工作正常,但是当我直接访问 /signin 时,它返回 NOT FOUND、AWS 的 Https 请求和负载均衡器,以及本地 web 开发环境搭建的有用信息。

本文目录一览:

使用jax-ws调用位于负载均衡器上的Web服务会返回http状态302,但是当我使用SoapUI时,它可以正常工作

使用jax-ws调用位于负载均衡器上的Web服务会返回http状态302,但是当我使用SoapUI时,它可以正常工作

当我使用jax-ws调用位于负载均衡器上的Web服务时,它将返回

服务器发送了HTTP状态代码302:临时移动

然后失败,但是当我使用SoapUI时,它工作正常。

有没有一种方法可以配置服务以正确处理此问题?

我使用生成了Web服务代码,wsimport并因此进行了调用

NotificationWebService service = new NotificationWebService(wsdlLocation,qName);
NotificationWebServiceSoap serviceSoap = service.getNotificationWebServiceSoap();
String xmlString = serviceSoap.getRSAPublicKeyXMLString();

我陷入困境,无法在任何地方找到解决方案,因此将不胜感激。

Apache Web服务器不允许我在/ about上刷新,但在localhost上可以正常工作

Apache Web服务器不允许我在/ about上刷新,但在localhost上可以正常工作

我捆绑了一个项目,效果很好。但是,当在路由/ about上单击“刷新”时,它会显示在此服务器上找不到所请求的URL /
about。但是,当我在本地主机上从Web服务器上执行此操作时,在刷新和前进/后退按钮上都可以正常工作。我在我的客户端路由中使用react-router。

这是客户端路由,但我对此表示怀疑

 Router.run(routes, Router.HistoryLocation, function (Handler) {    React.render(<Handler/>, app); });

我的路线就在那里:

let routes = (<Route>  <Route name = "App" path="/" handler = {App}>    <Route name="About" path="/about" handler = {About}/>    <DefaultRoute name="Projects" handler = {Projects}/>  </Route></Route>        );

我认为我破坏了APACHE:

<Directory /var/www/>                # This directive allows us to have apache2''s default start page                # in /apache2-default/, but still have / go to the right placeRequire all granted                #RedirectMatch ^/$ /apache2-default/        </Directory>

kkotwal.me.conf:

<VirtualHost *:80>        # The ServerName directive sets the request scheme, hostname and port that        # the server uses to identify itself. This is used when creating        # redirection URLs. In the context of virtual hosts, the ServerName        # specifies what hostname must appear in the request''s Host: header to        # match this virtual host. For the default virtual host (this file) this        # value is not decisive as it is used as a last resort host regardless.        # However, you must set it for any further virtual host explicitly.        #        ServerName kkotwal.me        ServerAlias www.kkotwal.me        ServerAdmin webmaster@localhost        DocumentRoot /var/www/kkotwal.me/public_html        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,        # error, crit, alert, emerg.        # It is also possible to configure the loglevel for particular        # modules, e.g.        #LogLevel info ssl:warn        ErrorLog ${APACHE_LOG_DIR}/error.log        CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>

答案1

小编典典

嘿,这实际上是一件很普通的事情。

发生的事情是,您需要使apache服务器忽略任何嵌套的路径,而只是将所有请求发送/*到root。这样,您的前端javascript可以在客户端选择路由并显示正确的视图。

有时在不同的Web服务器中将其称为“ HTML5模式”。

在apache中,您可以按照以下方式添加一条规则:

  RewriteEngine On    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d  RewriteRule ^ - [L]  RewriteRule ^ /index.html [L]

这样做是为了告诉Apache提供任何存在的文件,但是如果它们不存在,则仅提供/index.html而不是找不到404。

asp.net – 如果内容是静态的,那么对于带有“If-Modified-Since”的请求,总是返回http状态304是否可以

asp.net – 如果内容是静态的,那么对于带有“If-Modified-Since”的请求,总是返回http状态304是否可以

在我们的Asp.Net应用程序中,我们有一个IHttpHandler处理图像请求.
使用特殊id调用Handler,该id标识图像缓存中的图像.
一旦图像投入现金,它就永远不会改变.
我的问题是:

是否可以在没有实际检查给定日期的情况下始终为具有“If-Modified-Since”标头的请求返回http状态代码304?
原因是浏览器必须已经拥有该映像的副本(因为它提供了modified-since标头).

这将使生活更轻松,因为我们(尚未)跟踪图像创建日期.

这是实际代码(更新:我现在在Aristos推荐的服务器响应中包含了if-modified标头):

public void ProcessRequest(HttpContext context)
{
    if (!String.IsNullOrEmpty(context.Request.Headers["If-Modified-Since"])) {
        //Is this okay?
        context.Response.StatusCode = 304;
        context.Response.StatusDescription = "Not Modified";
        return;
    }
    var thumbnailId = context.Request.QueryString["thumbnail"];
    using (var thumbnailCache = new CThumbnailCache()) {
        var imageBytes = thumbnailCache.GetimageById(thumbnailId);

        context.Response.ContentType = "image/png";
        var outputStream = context.Response.OutputStream;
        outputStream.Write(imageBytes,imageBytes.Count());
        context.Response.Cache.SetCacheability(HttpCacheability.Public);
        context.Response.Cache.SetLastModified(DateTime.UtcNow);
        // added after Aristos post
        context.response.addheader("If-Modified-Since",DateTime.UtcNow.ToString("r"));

        const int maxAge = 86400 * 14; // 14 Tage
        context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(maxAge));
        context.Response.Cache.SetMaxAge(new TimeSpan(0,maxAge));
        context.Response.CacheControl = "private";
        context.Response.Cache.SetValidUntilExpires(true);

    }
}

解决方法

从你获得If-Modified的那一刻起它就可以了 – 因为资源在浏览器上,你决定是否让它保持原样.

我喜欢这里说你们两个想.您似乎没有设置此标头,因此您可能无法通过浏览器获取它.

要使这个实际工作,您需要添加此行

context.response.addheader("If-Modified-Since",LastModifledOfImage.ToString());

或者当您发送当前日期时间时:

context.response.addheader("If-Modified-Since",DateTime.UtcNow.ToString());

当你发送图像.
我看到you use the SetLastModified,但是这是设置Last-Modified标头而不是你检查的标头.

如果可能的话,考虑使这个图像实际上是静态的,因为即使这个If-Modified-Since也会对服务器进行一次调用,但实际的静态资源直接从浏览器缓存中获取图像而不询问服务器.

AWS EC2:当我访问网站的 / 时,它工作正常,但是当我直接访问 /signin 时,它返回 NOT FOUND

AWS EC2:当我访问网站的 / 时,它工作正常,但是当我直接访问 /signin 时,它返回 NOT FOUND

我发现了问题。 我不得不从 try_files $uri $uri/ =404; 中删除这行 location /

AWS 的 Https 请求和负载均衡器,以及本地 web 开发环境搭建

AWS 的 Https 请求和负载均衡器,以及本地 web 开发环境搭建

需要在 AWS 上发送 Https 请求,从 AWS 官网看了看资料,发现必须还要搭建 AWS 的负载均衡器。不太明白原因。然后查了查 Https 的资料,发现有介绍通过搭建 Negix 结合 Https 使用的。

先放官网文档:与 AWS Certificate Manager 集成的服务

https://docs.aws.amazon.com/zh_cn/acm/latest/userguide/acm-services.html

(AWS Certificate Manager 支持的 AWS 服务越来越多。您无法直接在基于 AWS 的网站或应用程序上安装 ACM 证书或私有 ACM PCA 证书。您必须使用以下服务之一。)

 

转载:静小妞的一篇文章

https://www.cnblogs.com/jingxiaoniu/p/6745254.html

大概了解了 Https 和 Negix 关系。

 

还有 AWS 本地开发环境的搭建:转载以下两篇博文

https://www.cnblogs.com/foxracle/archive/2012/07/12/2588246.html

https://blog.csdn.net/zhouyan8603/article/details/56015144

今天关于使用jax-ws调用位于负载均衡器上的Web服务会返回http状态302,但是当我使用SoapUI时,它可以正常工作的介绍到此结束,谢谢您的阅读,有关Apache Web服务器不允许我在/ about上刷新,但在localhost上可以正常工作、asp.net – 如果内容是静态的,那么对于带有“If-Modified-Since”的请求,总是返回http状态304是否可以、AWS EC2:当我访问网站的 / 时,它工作正常,但是当我直接访问 /signin 时,它返回 NOT FOUND、AWS 的 Https 请求和负载均衡器,以及本地 web 开发环境搭建等更多相关知识的信息可以在本站进行查询。

本文标签: