草庐IT

Host-header

全部标签

spring - 由于标准 header ,CORS 预检请求失败

在调试我遇到的CORS问题时,我发现了以下行为。Chrome发出以下OPTIONS预检请求(由Chrome自己用CURL重写):curl-v'https://www.example.com/api/v1/users'-XOPTIONS-H'Access-Control-Request-Method:POST'-H'Origin:http://example.com'-H'Accept-Encoding:gzip,deflate,sdch'-H'Accept-Language:es-ES,es;q=0.8,en;q=0.6'-H'User-Agent:Mozilla/5.0(X11;Li

spring - 由于标准 header ,CORS 预检请求失败

在调试我遇到的CORS问题时,我发现了以下行为。Chrome发出以下OPTIONS预检请求(由Chrome自己用CURL重写):curl-v'https://www.example.com/api/v1/users'-XOPTIONS-H'Access-Control-Request-Method:POST'-H'Origin:http://example.com'-H'Accept-Encoding:gzip,deflate,sdch'-H'Accept-Language:es-ES,es;q=0.8,en;q=0.6'-H'User-Agent:Mozilla/5.0(X11;Li

java - 将我的自定义 http header 添加到 Spring RestTemplate 请求/扩展 RestTemplate

我当前的代码:RestTemplaterestTemplate=newRestTemplate();restTemplate.getMessageConverters().add(newMappingJackson2HttpMessageConverter());Mall[]malls=restTemplate.getForObject(url,Mall[].class);我需要为我的请求添加一些自定义header,格式为:X-TP-DeviceID:就我而言,最简单的方法是什么?在将请求发送到服务器之前,有什么方法可以将自定义header定义添加到我的restTemplate对象?[

java - 将我的自定义 http header 添加到 Spring RestTemplate 请求/扩展 RestTemplate

我当前的代码:RestTemplaterestTemplate=newRestTemplate();restTemplate.getMessageConverters().add(newMappingJackson2HttpMessageConverter());Mall[]malls=restTemplate.getForObject(url,Mall[].class);我需要为我的请求添加一些自定义header,格式为:X-TP-DeviceID:就我而言,最简单的方法是什么?在将请求发送到服务器之前,有什么方法可以将自定义header定义添加到我的restTemplate对象?[

ruby-on-rails - rails/Rack : retrieving request params from within canonical_host middleware

我将RackCanonicalHost中间件(https://github.com/tylerhunt/rack-canonical-host)与Rails一起使用,以强制所有根请求使用www(example.com变为www.example.com)。但是,如果访问者试图访问我们应用程序的有效子域,我们显然不想强制访问www.下面是中间件的示例用法:Rails.application.config.middleware.useRack::CanonicalHostdo#thefollowingreturnvaluewillbeusedtosetthecanonicalhost'www

ruby-on-rails - rails : configuring a form action's host using custom URL from settings

我有一个Rails应用程序,我在生产环境中跨域提供该应用程序。它需要绝对引用。因此,我在config/environments/production.rb中启用了以下内容:config.action_controller.asset_host="http://myapp.herokuapp.com"这适用于图像和资源,但我的输入表单看起来像这样:'post',:remote=>true)do%>仍在控制台中得到这个:Failedtoloadresourcefile://localhost/plans/collapse_plan如何更改它以便表单操作自动包含指定的主机,而不是默认为本地主

ruby-on-rails - cucumber default_url_options[ :host] everytime "www.example.com" even if specified in environtemnts/test. rb

我在environments/test.rb中指定了default_url_optionsconfig.action_mailer.default_url_options={:host=>"www.xyu.at"}这很好,在我测试用户注册的cucumber故事中,用户激活链接正确生成invitation_activation_url(1)=>"www.xyu.at/signup/1231hj23jh23"但是当我尝试使用features/steps/user_steps.rb中的以下代码访问电子邮件中提供的链接时(使用来自http://github.com/bmabey/email-s

ruby - Savon:如何将标题从 <env:Header> 更改为 <soap:Header> 或其他内容

在Savon,有没有办法改变成为还是有什么不同?我试过在请求block中放置一个额外的标题标签,如下所示:soap.header['soap:Header']但这行不通。我浏览过SavonDocs并且还没有找到更改该标记的任何地方,只能通过手动构建XML。 最佳答案 为Savon1.0.0编辑该值可以在配置block中设置,您还可以在其中设置日志记录和其他参数。简单地说Savon.configuredo|c|c.env_namespace=:soapend进入你的代码。 关于ruby-S

ruby-on-rails - 在 http header 中设置身份验证 token

我一直在关注关于如何设置身份验证token的railscasthttp://railscasts.com/episodes/352-securing-an-api?view=asciicast我已经很好地设置了我的应用程序,它使用authenticate_or_request_with_http_token方法来获取token。我的问题是我有一个下一个应用程序需要在header中设置token。像这样的东西:uri=URI.parse(full_url)http=Net::HTTP.new(uri.host,uri.port)request=Net::HTTP::Get.new(uri

javascript - 如何将过期 header 添加到 Meteor 静态 Assets

是否可以将过期header添加到meteor中的静态Assets?或者配置它们的方法?谢谢! 最佳答案 为了在生产中使用,建议您始终在客户端和meteor服务器之间使用nginx代理。因此,将缓存header添加到静态目录中的文件的最佳方法是将它们添加到nginx配置中。只需采用meteornginx配置,就像DavidWeldon所做的那样:gist然后添加以下位置:location/static{proxy_passhttp://localhost:3000/static;proxy_http_version1.1;proxy_