我正在开发一个部署在 Heroku 上的小组项目,但现在我需要对其进行进一步的工作,并尝试让它再次在本地运行。这是一个使用 MongoDB 的 React 应用程序。我克隆了存储库,并在根文件夹和客户端文件夹中安装了 npm。当我输入 npm run dev 时,页面出现,但功能不起作用。当我尝试登录、注册或提交照片时出现错误:
\n\n从航站楼:
\n\n[1] Proxy error: Could not proxy request /api/account/signin from localhost:3000 to http://localhost:3001/.\n[1] See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).\nRun Code Online (Sandbox Code Playgroud)\n\n从控制台:
\n\nPOST http://localhost:3000/api/account/signin 500 (Internal Server Error)\nUncaught (in promise) Error: Request failed with status code 500\n at createError (createError.js:16)\n at settle (settle.js:18)\n at XMLHttpRequest.handleLoad (xhr.js:77)\nRun Code Online (Sandbox Code Playgroud)\n\n我查看了错误日志,似乎服务器拒绝建立连接。我不知道问题出在哪里。最让我困惑的是,我的另一位团队成员也克隆了该存储库,并声称一切都对他有用。它在 Heroku 上部署时也能正常运行。我的计算机上是否存在可能导致问题的特定设置?我的防火墙已关闭。如果是代码问题,以下是其中的一些问题:
\n\n服务器.js:
\n\nconst express = require(\'express\');\nconst app = express();\nconst mongoose = require(\'mongoose\');\nconst bodyParser = require(\'body-parser\'); …Run Code Online (Sandbox Code Playgroud) 我正在构建一个应用程序,需要对 api-数据组合使用情况进行一些分析。下面是我的 nginx 配置 -
location /r/ {
rewrite /r/(.*)$ http://localhost:3000/sample/route1/$1 redirect;
post_action /aftersampleroute1/$1;
}
location /aftersampleroute1/ {
rewrite /aftersampleroute1/(.*) /stats/$1;
proxy_pass http://127.0.0.1:3000;
}
Run Code Online (Sandbox Code Playgroud)
location/r/用于将浏览器请求重定向http://localhost:80/r/quwjDP4us到 api /sample/route1/quwjDP4us,该 api 使用 idquwjDP4us执行某些操作。现在在后台我想将 id 传递quwjDP4us给统计 api/stats/quwjDP4us,该 api 会更新该 id 的数据库记录。
当我启动 nginx 并发出请求时,http://localhost:80/r/quwjDP4usnginx 成功将我的请求重定向到我的应用程序,但不会在后台向 stats api 发出第二个请求。我缺少什么?
注意 -post_action不包含在 nginx 文档中,是否有我可以使用的备用模块/指令?
在开发中,我有本地 vue.js 项目和开发服务器。我遵循了这个指南:
http://vuejs-templates.github.io/webpack/proxy.html
设置proxyTable以便每当我使用 向开发服务器进行RESTAxios调用时,它都会重定向到我的开发服务器而不是 vue url。
当我部署到 prod 时,我的 vue 构建包被部署到 S3 ,而我的其余服务器位于EBS中。它们位于不同的子域中。所以我的 Vue 还需要为所有REST调用设置代理。但是, vuejs&webpack不允许在配置文件中使用 proxyTablebuild部分。处理这个问题的最佳方法是什么?
我的配置:
module.exports = {
build: {
env: 'prod',
productionSourceMap: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
logLevel: 'info',
target: 'http://myRestServer.com/...',
changeOrigin: true,
pathRewrite: {
'^/api': '/'
}
}
},
},
dev: {
proxyTable: {
'/api': {
logLevel: 'info',
target: 'http://127.0.0.1:3005',
changeOrigin: true,
pathRewrite: {
'^/api': '/'
} …Run Code Online (Sandbox Code Playgroud) 对于@ManyToOneJPA 实体中的关系,我只对实际 id 引用感兴趣,而不是获取与该关系关联的整个模型。
以这些 Kotlin JPA 实体为例:
@Entity
class Continent(
@Id
var id: String,
var code: String,
var name: String
) : Comparable<Continent> {
companion object {
private val COMPARATOR = compareBy<Continent> { it.id }
}
override fun compareTo(other: Continent): Int {
return COMPARATOR.compare(this, other)
}
}
@Entity
class Country(
@Id
var id: String,
var alpha2Code: String,
var alpha3Code: String,
var name: String,
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "continent_id")
var continent: Continent
) : Comparable<Country> {
companion …Run Code Online (Sandbox Code Playgroud) 我正在制作一个扩展,允许用户存储具有身份验证凭据(用户/通行证)的代理服务器并在服务器之间切换。我正在侦听该webRequest.onAuthRequired事件,当服务器挑战身份验证时,证明用户已保存的用户名/密码,如下例所示provideCredentialsSync: https: //developer.mozilla.org/en-US/docs/Mozilla/Add- ons/WebExtensions/API/webRequest/onAuthRequired#Examples
问题是,当提供这些凭据时,它们似乎会保存/缓存在开发人员无权访问的扩展中的某个位置,然后不断地重复使用。因此,如果扩展用户随后将其凭据更改为不正确,则浏览器会自动继续使用其Proxy-Authorization标头中经过身份验证的凭据,并且请求会成功。反之亦然,如果身份验证失败,并且请求按照上面的示例被取消,则用户将其信用更改为正确的,服务器不会再次询问身份验证,并且请求失败,并且无法提供新的信用。
Chrome 也不允许修改传出Proxy-Authorization标头,这意味着不能在代码中删除/更改它以强制服务器再次质询。
所以我认为核心问题是:
有谁知道从侦听器返回时详细信息保存在哪里
webRequest.onAuthRequired,有没有办法清除/清除?
返回时实际发生了什么{cancel: true}以及为什么对该服务器的所有请求都会继续失败而不触发另一个onAuthRequired?
感谢任何人都能发出的光芒!
javascript authentication proxy google-chrome-extension firefox-addon-webextensions
当我跑步时sudo docker-compose build我得到
Building web
Step 1/8 : FROM python:3.7-alpine
ERROR: Service 'web' failed to build: error parsing HTTP 403 response body: invalid character '<' looking for beginning of value: "<html><body><h1>403 Forbidden</h1>\nSince Docker is a US company, we must comply with US export control regulations. In an effort to comply with these, we now block all IP addresses that are located in Cuba, Iran, North Korea, Republic of Crimea, Sudan, and Syria. If you are not in one …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过 create-next-app 部署 next-js 应用程序,我有一个像这样的自定义 Express 服务器 -
const express = require('express')
const next = require('next')
const dev = process.env.NODE_ENV !== 'production'
const nextApp = next({ dev })
const handle = nextApp.getRequestHandler()
const fs = require('fs')
nextApp.prepare()
.then(() => {
const server = express ()
let port = 3000;
let options = {
key: fs.readFileSync('some key..', 'utf-8'),
cert: fs.readFileSync('some cert..', 'utf-8'),
};
server.get(
...
)
let app = https.createServer(options, server)
.listen((port), function(){
console.log("Express server listening on port " + port); …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用setRecommendedGlobalProxy方法为 Android 设备设置一个独立于网络的代理服务器。
ProxyInfo proxyInfo = ProxyInfo.buildDirectProxy(hostname, port);
devicePolicyManager.setRecommendedGlobalProxy(deviceAdmin, proxyInfo);
Run Code Online (Sandbox Code Playgroud)
当代理服务器没有任何身份验证时,此方法有效。ProxyInfo当存在用户名和密码时,应该如何设置对象的凭据。
我尝试将主机名设置为,username:password@proxyserverhost.com但似乎设备没有选择代理设置。我可以在日志猫中看到以下错误。
1666-5220/? D/ConnectivityService: Invalid proxy properties, ignoring: [test:abc123@10.0.0.6] 3128
Run Code Online (Sandbox Code Playgroud) 因此,我尝试在反向代理后面设置一个 Spring Boot 应用程序,但是当我使用它时,HttpServletResponse.redirect("/")它总是重定向到内部 url。无论有没有 都会发生这种情况use-forward-headers: true。
我从反向代理获得的标头如下:
upgrade-insecure-requests: 1
forwarded: for=10.x.x.x;host=internal-domain.com;proto=http
x-forwarded-server: external-domain.com
host: internal-domain.com
x-forwarded-host: internal-domain.com
x-forwarded-port: 80
x-forwarded-proto: http
Run Code Online (Sandbox Code Playgroud)
我无法更改反向代理返回的内容。
如果有人可以提供帮助,那就太棒了:) 谢谢
使用 next.js 版本8.0.3我不知道如何在具有不同子路径的代理下提供自定义服务器。
我正在做:
npm run build && npm start
以便构建并开放自定义服务器。
我没有打开http://localhost:3000 ,而是使用带有另一个子路径http://localhost:8000/example 的代理。
代理很简单,重现它:
代理.js
const express = require('express')
const proxy = require('http-proxy-middleware')
const options = {
target:'http://localhost:3000/',
}
const exampleProxy = proxy(options)
const app = express()
app.use('/example', exampleProxy)
app.listen(8000)
Run Code Online (Sandbox Code Playgroud)
进而:
node proxy.js
Run Code Online (Sandbox Code Playgroud)
但是,当我打开http://localhost:8000/example url 时,正在加载主页,但没有样式、静态、javascript...任何东西...
我怎样才能正确地做到这一点?
太感谢了!