Im using chromedriver to be specific and not involved in any code.
I've tried to sent post request directly to chromedriver to create new session and successfully configured them with a public proxy (no authentication), but it didn't seem to work when i switch to a private one (still can access to the internet and ip remains the same as my PC). Of course, I guaranteed that my private proxy and its authentication are valid and working.
My private proxy infos: IPv4, HTTP, auth with username and password.
And here is how i formatted the request's body with
Public proxy:
{
"capabilities": {
"alwaysMatch": {
"goog:chromeOptions": {
"w3c": true,
"excludeSwitches": [
"enable-automation"
]
},
"proxy": {
"proxyType": "manual",
"httpProxy": "ip:port"
}
}
}
}
Private proxy:
{
"capabilities": {
"alwaysMatch": {
"goog:chromeOptions": {
"w3c": true,
"excludeSwitches": [
"enable-automation"
]
},
"proxy": {
"proxyType": "manual",
"httpProxy": "username:password#ip:port"
}
}
}
}
I've also tried to use "http://username:password#ip:port".
Is the "httpProxy" property being wrongly formatted?
Edit: the driver accept the private proxy without providing username:password but prompted to enter them later on. But are there any workarounds to automatically login by simply using some kind of url scheme like username:password#ip:port?
Related
I need your help!
I'm not a profissional, but I'm trying to create a proxy Chrome Extension, and It is working fine!
However, I'd like it works only for some specifics website, not for all.
Currently, It is working for all website, how could I set it to work only for youtube, google and netflix?
function startProxy() {
var config = {
mode: "fixed_servers",
rules: {
singleProxy: {
scheme: "http",
host: "IP", // Proxy IP or URL: type -> string
port: 80 // Proxy port : type -> int
},
bypassList: ["localhost"]
}
};
chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});
}
function callbackFn(details) {
return {
authCredentials: {
username: "USER",
password: "PW"
}
};
}
chrome.webRequest.onAuthRequired.addListener(
callbackFn,
{urls: ["<all_urls>"]},
['blocking']
);
startProxy();
My main aim is to modify the origin header to some specific origin, but I am unable to modify any header of the request.
I tried with onBeforeSendHeaders event listener with extraHeaders option
chrome.webRequest.onBeforeSendHeaders.addListener((details) => {
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name.toLowerCase() === 'origin') {
details.requestHeaders[i].value = "https://bar.com"
break;
}
}
console.log(details);
return { requestHeaders: details.requestHeaders };
}, {
urls: [
"https://*.foo.com/*"
]
}, ['extraHeaders', 'requestHeaders']);
Later I also tried changing the user-agent header with the code provided in the documentation - https://developer.chrome.com/docs/extensions/reference/webRequest/#examples
but none of it worked, headers are getting changed in the logged object but
then I logged the headers with onSendHeaders event listener with this code
chrome.webRequest.onSendHeaders.addListener((details) => {
console.log("Header sent", details)
}, {
urls: [
"https://*.foo.com/*"
]
}, ['extraHeaders', 'requestHeaders']);
and it shows none of the headers changed.
I am not using any other extension (disabled all).
I am using manifest version 3 and I have these permissions
"permissions": [
"tabs",
"scripting",
"webRequest"
],
"host_permissions": [
"https://*.foo.com/*",
"https://*.bar.com/*"
]
My Browser : Version 92.0.4515.159 (Official Build) (64-bit)
My OS: Linux Mint 20.1 Ulyssa
Any help will be much appreciated. Thank you
I'm working on a Azure Functions App and i have some issues with the routes, when I add a matching rule with * inside, it doesn't work anymore. Anyone have an idea of what I'm doing wrong ?
When I uncomment one of the other rules or just change the route of Test Route from /{code} to /{*code}, it fails and gives me the Bad Request response.
My routing file proxies.json
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"Test Route": {
"matchCondition": {
"route": "/{code}"
},
"backendUri": "https://%WEBSITE_HOSTNAME%/api/UrlTester/{code}"
}
//,
//"Let's Encrypt Support" : {
// "matchCondition": {
// "route": "/.well-known/acme-challenge/{*code}"
// },
// "backendUri": "https://%WEBSITE_HOSTNAME%/api/LetsEncrypt/{code}"
//},
//"Domain Redirect": {
// "matchCondition": {
// "route": "/{*shortUrl}"
// },
// "backendUri": "http://%WEBSITE_HOSTNAME%/api/UrlRedirect/{shortUrl}"
//},
//"Api": {
// "matchCondition": {
// "route": "/api/{*path}"
// },
// "backendUri": "http://%WEBSITE_HOSTNAME%/api/{path}"
//}
}
}
I'm using this following fork: https://github.com/duijvelshoff/serverless-url-shortener
And this documentation: https://learn.microsoft.com/en-us/azure/azure-functions/functions-proxies
Thanks.
As per this github issue a catchall {* route redirecting to the same function app will cause a 400 response.
Moving your HTTP triggered functions to a separate function app, and changing the backend URLs will fix your issues.
try something like "route": "id={code}"
I have a basic authentication for a SSRS report server, to avoid the login pop up window while hitting a SSRS report server from a web server. I'm sending the credentials in url itself. It was working upto google chrome 58, but now it is updated to chrome 59. Now i'm not able to send credentials in the browser url.
Example https://gooduser:secretpassword#www.example.co
username : gooduser
password : secredpassword
Kindly help on this please!
I solve the same problem with chrome extension.
In extension background.js
chrome.extension.onMessage.addListener( function(request, sender, sendResponse){
chrome.webRequest.onAuthRequired.addListener(
function(details, callbackFn) {
console.log("onAuthRequired!", details, callbackFn);
callbackFn({
authCredentials: {username: request.username, password: request.password }
});
},
{urls: request.url + "/*"]},
['asyncBlocking']
);
});
in extension contentscript.js
window.addEventListener("message", function(event) {
if ( event.type == "BASIC_AUTH" ) {
chrome.runtime.sendMessage(
event.data,
event.data.sender,
function (response) {}
);
}
});
in HTML javascript
window.postMessage({ type: "BASIC_AUTH", url:"www.mydomain.com", username:"myusername", password:"mypassword" }, "*");
If you like use extensions from Chrome Web Store like : MultiPass for HTTP basic authentication
You can use the "MultiPass for HTTP basic authentication" Chrome Extension to handle this.
You can do via GitHub MultiPass for HTTP basic authentication
(or)
Download the extension from Chrome Web Store - MultiPass Chrome Extension
(Or)
Download the extension as crx. You can get it as crx from chrome-extension-downloader
Once you download the Extension as crx File - Configuring the same into your Test/Source is very simple.
And this can be tested using the Sample Basic Auth-Site.
public class ChromeAuthTest {
WebDriver driver;
public ChromeAuthTest() {
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
}
private void initDriver() {
ChromeOptions cOptions = new ChromeOptions();
cOptions.addExtensions(new File("MultiPass-for-HTTP-basic-authentication_v.crx"));
driver = new ChromeDriver(cOptions);
configureAuth(
"https://the-internet.herokuapp.com/basic_auth",
"admin",
"admin");
}
private void configureAuth(String url, String username, String password) {
driver.get("chrome-extension://enhldmjbphoeibbpdhmjkchohnidgnah/options.html");
driver.findElement(By.id("url")).sendKeys(url);
driver.findElement(By.id("username")).sendKeys(username);
driver.findElement(By.id("password")).sendKeys(password);
driver.findElement(By.className("credential-form-submit")).click();
}
public void doTest() {
initDriver();
driver.get("https://the-internet.herokuapp.com/basic_auth");
System.out.println(driver.getTitle());
driver.quit();
}
public static void main(String[] args) {
new ChromeAuthTest().doTest();
}
}
NOTE: This is taken from this Answer.
Hope this helps!
I've got android and web apps. Android app uses Couchbase Lite, web app uses Couchbase. I'm using Couchbase Sync Gateway to enable data replication between those two databases.
So far it works ok for sending data from mobile and receiving it both in web app and second mobile device. I noticed that all send documents have "_sync" parameter added.
My question is how can I enable documents added through web app (to couchbase database) to take part in replication? (they don't have field "_sync" by default)
edit
As Legendary_Hunter suggested I tried using Shadow, but still can't get it working. My config file:
{
"log":["CRUD+", "REST+", "Changes+", "Attach+"],
"databases": {
"kris_mobile_db": {
"server":"http://192.168.0.11:8091",
"sync":`
function (doc) {
channel (doc.channels);
}`,
"bucket":"kris_mobile_db",
"users": {
"GUEST": {
"disabled": false,
"admin_channels": ["*"]
}
},
"shadow": {
"server": "http://localhost:8091",
"bucket": "kris_mobile_db_sync"
}
}
}
}
edit2 (29.05.16)
public class DatabaseManager {
private static DatabaseManager manager;
private static CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder().autoreleaseAfter(6000).build();
private static String bucketName = "kris_mobile_db";
private Cluster cluster;
private Bucket bucket;
public static DatabaseManager getInstance(){
if(manager == null)
manager = new DatabaseManager();
return manager;
}
public Bucket getBucketInstance(){
if(bucket == null)
bucket = cluster.openBucket(bucketName);
return bucket;
}
public boolean establishConnection(String host, String port, String bucketName){
// host: 192.168.0.11, port: 8091
cluster = CouchbaseCluster.create(env, host+":"+port);
DatabaseManager.bucketName = bucketName;
bucket = cluster.openBucket(bucketName);
return true;
}
}
and inserting is like
JsonDocument doc = JsonDocument.create(docId, content);
DatabaseManager.getInstance().getBucketInstance().insert(doc);
edit3
So finally I managed to get shadowing working. If anyone had the same problem. My basic database is kris_mobile_db and syncGateway shadowing database is kris_mobile_db_sync. Config file:
{
"log":["CRUD+", "REST+", "Changes+", "Attach+"],
"databases": {
"kris_mobile_db": {
"server":"http://192.168.0.11:8091",
"sync":`
function (doc) {
channel (doc.channels);
}`,
"bucket":"kris_mobile_db_sync",
"users": {
"GUEST": {
"disabled": false,
"admin_channels": ["*"]
}
},
"shadow":{
"server":"http://192.168.0.11:8091",
"bucket":"kris_mobile_db"
}
}
}
}
Just use bucket shadowing. It is bidirectional syncing of sync gateway bucket with any bucket of couchbase server.
If you want to keep all the good things that the Sync Function gives you, than you have to go through the sync gateway. The sync gateway exposes a REST API that you can use to build your web app.